Drown event

we all need to know when they drown
This commit is contained in:
LeoDog896
2020-09-25 12:01:59 -04:00
parent 85d32cd510
commit c912eb197b
2 changed files with 11 additions and 1 deletions

View File

@@ -1,10 +1,12 @@
package mindustry.entities.comp;
import arc.Events;
import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.game.EventType.*;
import mindustry.gen.*;
import mindustry.world.blocks.environment.*;
@@ -90,7 +92,7 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
//TODO is the netClient check necessary?
if(drownTime >= 0.999f && !net.client()){
kill();
//TODO drown event!
Events.fire(new UnitDrownEvent(self()));
}
}else{
drownTime = Mathf.lerpDelta(drownTime, 0f, 0.03f);

View File

@@ -270,6 +270,14 @@ public class EventType{
}
}
public static class UnitDrownEvent{
public final Unit unit;
public UnitDrownEvent(Unit unit){
this.unit = unit;
}
}
public static class UnitCreateEvent{
public final Unit unit;