Skip to content

Commit

Permalink
feat(gestaltv7-eventsystem): Migration Event and @ReceiveEvent to ges…
Browse files Browse the repository at this point in the history
…talt's (#87)
  • Loading branch information
DarkWeird authored Dec 7, 2021
1 parent ea5c7f5 commit adce78a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnAddedComponent;
import org.terasology.engine.entitySystem.event.EventPriority;
import org.terasology.engine.entitySystem.event.ReceiveEvent;
import org.terasology.engine.entitySystem.event.Priority;
import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
import org.terasology.engine.entitySystem.systems.RegisterMode;
import org.terasology.engine.entitySystem.systems.RegisterSystem;
Expand All @@ -21,6 +21,7 @@
import org.terasology.engine.registry.In;
import org.terasology.engine.rendering.assets.animation.MeshAnimation;
import org.terasology.engine.rendering.logic.SkeletalMeshComponent;
import org.terasology.gestalt.entitysystem.event.ReceiveEvent;
import org.terasology.wildAnimals.component.WildAnimalComponent;

@RegisterSystem(RegisterMode.AUTHORITY)
Expand Down Expand Up @@ -65,7 +66,8 @@ public void addedDestroyAtAnimationEndComponent(OnAddedComponent event, EntityRe
* Removes extra components from the animal entity and updates skeletalMesh to play dying animation
* Triggers the entity to self destruct after animation ends by attaching DestroyAtAnimationEndComponent
*/
@ReceiveEvent(priority = EventPriority.PRIORITY_HIGH, components = {WildAnimalComponent.class, DieComponent.class})
@Priority(EventPriority.PRIORITY_HIGH)
@ReceiveEvent(components = {WildAnimalComponent.class, DieComponent.class})
public void onDeath(BeforeDestroyEvent event, EntityRef entity, DieComponent dieComponent) {
event.consume();
entity.removeComponent(BehaviorComponent.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
package org.terasology.wildAnimals.WorldlyTooltipDisplay;

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.common.DisplayNameComponent;
import org.terasology.gestalt.entitysystem.event.ReceiveEvent;
import org.terasology.module.inventory.ui.GetItemTooltip;
import org.terasology.nui.widgets.TooltipLine;
import org.terasology.wildAnimals.component.WildAnimalComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.wildAnimals.event;

import org.terasology.engine.entitySystem.event.Event;
import org.terasology.gestalt.entitysystem.event.Event;

public class AnimalGrowthEvent implements Event {
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.terasology.engine.entitySystem.entity.EntityManager;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.entity.lifecycleEvents.OnActivatedComponent;
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;
Expand All @@ -16,6 +15,7 @@
import org.terasology.engine.registry.In;
import org.terasology.engine.utilities.random.FastRandom;
import org.terasology.engine.utilities.random.Random;
import org.terasology.gestalt.entitysystem.event.ReceiveEvent;
import org.terasology.wildAnimals.component.WildAnimalComponent;
import org.terasology.wildAnimals.component.WildAnimalGrowthComponent;
import org.terasology.wildAnimals.event.AnimalGrowthEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.joml.Vector3ic;
import org.terasology.engine.entitySystem.entity.EntityManager;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.entitySystem.event.ReceiveEvent;
import org.terasology.engine.entitySystem.prefab.Prefab;
import org.terasology.engine.entitySystem.systems.BaseComponentSystem;
import org.terasology.engine.entitySystem.systems.RegisterMode;
Expand All @@ -23,6 +22,7 @@
import org.terasology.engine.world.block.BlockManager;
import org.terasology.engine.world.chunks.Chunks;
import org.terasology.engine.world.chunks.event.OnChunkGenerated;
import org.terasology.gestalt.entitysystem.event.ReceiveEvent;
import org.terasology.wildAnimals.AnimalSpawnConfig;

import java.util.ArrayList;
Expand Down

0 comments on commit adce78a

Please sign in to comment.