Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add documentation #221

Merged
merged 11 commits into from
Jul 7, 2021
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.components;

import org.terasology.engine.entitySystem.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.components;

import org.terasology.engine.entitySystem.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.components;

import org.terasology.engine.entitySystem.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.components;

import org.terasology.engine.entitySystem.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import org.terasology.engine.entitySystem.entity.EntityManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import org.joml.Vector3f;
Expand All @@ -35,6 +22,14 @@ public class ClientParticleSystem extends BaseComponentSystem {
@In
private EntityManager entityManager;

/**
* Attaches a particle emitter to the player when the player picks up a flag, which emits particles based on the flag's team.
jdrueckert marked this conversation as resolved.
Show resolved Hide resolved
* @see OnFlagPickupEvent
* @see org.terasology.ligthandshadow.componentsystem.controllers.AttackSystem
*
* @param event
* @param entity
*/
@ReceiveEvent
public void onFlagPickup(OnFlagPickupEvent event, EntityRef entity) {
String team = event.getTeam();
Expand All @@ -52,6 +47,14 @@ public void onFlagPickup(OnFlagPickupEvent event, EntityRef entity) {
}
}

/**
* Removes the particle emitter from the player when the player drops the flag.
* @see OnFlagDropEvent
* @see org.terasology.ligthandshadow.componentsystem.controllers.AttackSystem
*
* @param event
* @param entity
*/
@ReceiveEvent
public void onFlagDrop(OnFlagDropEvent event, EntityRef entity) {
EntityRef player = event.getPlayer();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.event.ReceiveEvent;
import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
import org.terasology.engine.entitySystem.systems.RegisterMode;
import org.terasology.engine.entitySystem.systems.RegisterSystem;
import org.terasology.engine.logic.players.LocalPlayer;
import org.terasology.engine.registry.In;
import org.terasology.engine.rendering.nui.NUIManager;
import org.terasology.engine.rendering.nui.layers.ingame.DeathScreen;
import org.terasology.ligthandshadow.componentsystem.LASUtils;
import org.terasology.ligthandshadow.componentsystem.events.ClientRestartEvent;
import org.terasology.nui.layouts.miglayout.MigLayout;

/**
* System to close game over screen once restart is complete.
*/

@RegisterSystem(RegisterMode.CLIENT)
public class ClientRestartSystem extends BaseComponentSystem {
@In
LocalPlayer localPlayer;
@In
NUIManager nuiManager;

@ReceiveEvent
public void onClientRestart(ClientRestartEvent event, EntityRef clientEntity) {
if (localPlayer.getClientEntity().equals(clientEntity)) {
if (nuiManager.isOpen(LASUtils.DEATH_SCREEN)) {
DeathScreen deathScreen = (DeathScreen) nuiManager.getScreen(LASUtils.DEATH_SCREEN);
MigLayout migLayout = deathScreen.find("playerStatistics", MigLayout.class);
if (migLayout != null) {
migLayout.removeAllWidgets();
}
nuiManager.closeScreen(LASUtils.DEATH_SCREEN);
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a documentation change, please extract it to another PR

Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import org.terasology.engine.entitySystem.entity.EntityRef;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2017 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import org.terasology.gestalt.assets.management.AssetManager;
Expand Down Expand Up @@ -50,7 +37,7 @@ public class ClientSkinSystem extends BaseComponentSystem {
private AssetManager assetManager;

/**
* Change the Health HUD when the local player is spawned based on their Light and Shadow Team.
* Initializes the Health HUD when the local player is spawned based on the default white team.
jdrueckert marked this conversation as resolved.
Show resolved Hide resolved
* @see LASTeamComponent
*
* @param event The event that is triggered when local player has been spawned
Expand All @@ -64,7 +51,7 @@ public void onAwaitedLocalCharacterSpawnEvent(AwaitedLocalCharacterSpawnEvent ev
}

/**
* Updates the skeletal mesh of a player when its visual character is being created.
* Initializes the skeletal mesh of a player to the mesh corresponding to the default white team when its visual character is being created.
* Default event handler for this event has Trivial priority. Hence, this method catches the event first
* and consumes it.
* @see CreateVisualCharacterEvent
Expand All @@ -87,7 +74,7 @@ public void onCreateDefaultVisualCharacter(CreateVisualCharacterEvent event, Ent
}

/**
* Updates the skeletal mesh of a player when its team changes.
* Updates the skeletal mesh and the Health HUD of a player when the player teleports to their teams base and their team is changed.
jdrueckert marked this conversation as resolved.
Show resolved Hide resolved
* @see LASTeamComponent
*
* @param event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import org.terasology.ligthandshadow.componentsystem.components.LASConfigComponent;
import org.terasology.engine.registry.In;

/**
* Provides an entity that keeps track of game state information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a system, not an entity, is it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is a system.

*/
@RegisterSystem
@Share(value = GameEntitySystem.class)
public class GameEntitySystem extends BaseComponentSystem {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2018 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import org.terasology.engine.entitySystem.entity.EntityManager;
Expand Down Expand Up @@ -45,7 +32,7 @@ public class LASSystem extends BaseComponentSystem {
private CelestialSystem celestialSystem;

/**
* Gives player inventory items on game start
* Gives an empty inventory to a player in the lobby to prevent fight's in the lobby.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to prevent fights in the lobby

Actually, I think we might want to make players invulnerable while in the lobby and allow fights 🤔

However, as what you wrote matches the current state, this is rather a topic for a follow-up PR.

*/
@ReceiveEvent(priority = EventPriority.PRIORITY_LOW)
public void onPlayerSpawn(OnPlayerSpawnedEvent event, EntityRef player, InventoryComponent inventory) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
/*
* Copyright 2019 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.ligthandshadow.componentsystem.controllers;

import java.util.Optional;
Expand Down Expand Up @@ -58,7 +45,7 @@ public class PlayerDeathSystem extends BaseComponentSystem {
private Random random = new Random();

/**
* Empty the inventory and send player player back to its base with refilled health.
* Reset the inventory and send player player back to its base with refilled health.
* This is a high priority method, hence it receives the event first and consumes it.
* This prevents the destruction of player entity and prevents the deathScreen from showing up.
*
Expand Down
Loading