progress
This commit is contained in:
@@ -8,6 +8,7 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.EventType.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
@@ -18,12 +19,14 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
||||
|
||||
@Import float x, y, speedMultiplier;
|
||||
@Import Vec2 vel;
|
||||
@Import UnitType type;
|
||||
|
||||
@SyncLocal float elevation;
|
||||
private transient boolean wasFlying;
|
||||
transient boolean hovering;
|
||||
transient float drownTime;
|
||||
transient float splashTimer;
|
||||
transient @Nullable Floor lastDrownFloor;
|
||||
|
||||
boolean checkTarget(boolean targetAir, boolean targetGround){
|
||||
return (isGrounded() && targetGround) || (isFlying() && targetAir);
|
||||
@@ -41,6 +44,12 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
||||
return isGrounded() && !hovering;
|
||||
}
|
||||
|
||||
//TODO
|
||||
@Nullable
|
||||
Floor drownFloor(){
|
||||
return null;
|
||||
}
|
||||
|
||||
void landed(){
|
||||
|
||||
}
|
||||
@@ -86,20 +95,23 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{
|
||||
}
|
||||
}
|
||||
|
||||
//TODO separate method?
|
||||
//TODO drown eligibility, store drown color.
|
||||
if(canDrown() && floor.isLiquid && floor.drownTime > 0){
|
||||
drownTime += Time.delta / floor.drownTime;
|
||||
drownTime = Mathf.clamp(drownTime);
|
||||
lastDrownFloor = floor;
|
||||
drownTime += Time.delta / floor.drownTime / type.drownTimeMultiplier;
|
||||
if(Mathf.chanceDelta(0.05f)){
|
||||
floor.drownUpdateEffect.at(x, y, 1f, floor.mapColor);
|
||||
}
|
||||
|
||||
//TODO is the netClient check necessary?
|
||||
if(drownTime >= 0.999f && !net.client()){
|
||||
kill();
|
||||
Events.fire(new UnitDrownEvent(self()));
|
||||
}
|
||||
}else{
|
||||
drownTime = Mathf.lerpDelta(drownTime, 0f, 0.03f);
|
||||
drownTime -= Time.delta / 50f;
|
||||
}
|
||||
|
||||
drownTime = Mathf.clamp(drownTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user