Search in sources :

Example 1 with DestroyEvent

use of org.terasology.engine.logic.health.DestroyEvent in project Terasology by MovingBlocks.

the class SideBlockSupportRequired method checkForSupport.

@ReceiveEvent
public void checkForSupport(DelayedActionTriggeredEvent event, EntityRef entity, BlockComponent block, SideBlockSupportRequiredComponent supportRequired) {
    if (event.getActionId().equals(SUPPORT_CHECK_ACTION_ID)) {
        if (!isSufficientlySupported(block.getPosition(), null, Collections.emptyMap(), supportRequired)) {
            PrefabManager prefabManager = CoreRegistry.get(PrefabManager.class);
            entity.send(new DestroyEvent(entity, EntityRef.NULL, prefabManager.getPrefab("engine" + ":supportRemovedDamage")));
        }
    }
}
Also used : DestroyEvent(org.terasology.engine.logic.health.DestroyEvent) PrefabManager(org.terasology.engine.entitySystem.prefab.PrefabManager) ReceiveEvent(org.terasology.engine.entitySystem.event.ReceiveEvent)

Example 2 with DestroyEvent

use of org.terasology.engine.logic.health.DestroyEvent in project Anatomy by Terasology.

the class CirculatoryEffectsSystem method onBloodLevelChanged.

@ReceiveEvent
public void onBloodLevelChanged(BloodLevelChangedEvent event, EntityRef entityRef, InjuredCirculatoryComponent injuredCirculatoryComponent) {
    if (injuredCirculatoryComponent.bloodLevel <= 0) {
        Prefab bloodLossDamage = prefabManager.getPrefab("Anatomy:bloodLoss");
        entityRef.send(new DestroyEvent(EntityRef.NULL, EntityRef.NULL, bloodLossDamage));
    }
}
Also used : DestroyEvent(org.terasology.engine.logic.health.DestroyEvent) Prefab(org.terasology.engine.entitySystem.prefab.Prefab) ReceiveEvent(org.terasology.gestalt.entitysystem.event.ReceiveEvent)

Aggregations

DestroyEvent (org.terasology.engine.logic.health.DestroyEvent)2 ReceiveEvent (org.terasology.engine.entitySystem.event.ReceiveEvent)1 Prefab (org.terasology.engine.entitySystem.prefab.Prefab)1 PrefabManager (org.terasology.engine.entitySystem.prefab.PrefabManager)1 ReceiveEvent (org.terasology.gestalt.entitysystem.event.ReceiveEvent)1