This commit is contained in:
Anuken
2021-08-22 00:30:15 -04:00
parent b2aaca45d5
commit b98395c8ba
4 changed files with 25 additions and 13 deletions

View File

@@ -819,7 +819,6 @@ public class UnitTypes implements ContentList{
legExtension = -20; legExtension = -20;
legBaseOffset = 8f; legBaseOffset = 8f;
landShake = 1f; landShake = 1f;
legSpeed = 0.1f;
legLengthScl = 0.93f; legLengthScl = 0.93f;
rippleScale = 3f; rippleScale = 3f;
legSpeed = 0.19f; legSpeed = 0.19f;
@@ -2416,6 +2415,7 @@ public class UnitTypes implements ContentList{
hitSize = 40f; hitSize = 40f;
omniMovement = false; omniMovement = false;
rotateSpeed = 1.7f; rotateSpeed = 1.7f;
drownTimeMultiplier = 4f;
drawCell = false; drawCell = false;
segments = 4; segments = 4;
drawBody = false; drawBody = false;

View File

@@ -46,7 +46,7 @@ abstract class CrawlComp implements Posc, Rotc, Hitboxc, Unitc{
public float floorSpeedMultiplier(){ public float floorSpeedMultiplier(){
Floor on = isFlying() ? Blocks.air.asFloor() : floorOn(); Floor on = isFlying() ? Blocks.air.asFloor() : floorOn();
//TODO take into account extra blocks //TODO take into account extra blocks
return on.speedMultiplier * speedMultiplier * lastCrawlSlowdown; return (on.isDeep() ? 0.45f : on.speedMultiplier) * speedMultiplier * lastCrawlSlowdown;
} }
@Override @Override

View File

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

View File

@@ -112,6 +112,7 @@ public class UnitType extends UnlockableContent{
public float dpsEstimate = -1; public float dpsEstimate = -1;
public float clipSize = -1; public float clipSize = -1;
public boolean canDrown = true; public boolean canDrown = true;
public float drownTimeMultiplier = 1f;
public float engineOffset = 5f, engineSize = 2.5f; public float engineOffset = 5f, engineSize = 2.5f;
public float strafePenalty = 0.5f; public float strafePenalty = 0.5f;
public float hitSize = 6f; public float hitSize = 6f;
@@ -795,9 +796,8 @@ public class UnitType extends UnlockableContent{
Draw.mixcol(unit.team.color, Mathf.absin(7f, 1f)); Draw.mixcol(unit.team.color, Mathf.absin(7f, 1f));
} }
Floor floor = unit.isFlying() ? Blocks.air.asFloor() : unit.floorOn(); if(unit.drownTime > 0 && unit.lastDrownFloor != null){
if(floor.isLiquid){ Draw.color(Color.white, unit.lastDrownFloor.mapColor, unit.drownTime * 0.4f);
Draw.color(Color.white, floor.mapColor, unit.drownTime() * 0.4f);
} }
} }
@@ -953,8 +953,8 @@ public class UnitType extends UnlockableContent{
Draw.mixcol(Color.white, unit.hitTime); Draw.mixcol(Color.white, unit.hitTime);
if(floor.isLiquid){ if(unit.lastDrownFloor != null){
Draw.color(Color.white, floor.mapColor, unit.drownTime() * 0.4f); Draw.color(Color.white, unit.lastDrownFloor.mapColor, unit.drownTime * 0.4f);
}else{ }else{
Draw.color(Color.white); Draw.color(Color.white);
} }
@@ -969,8 +969,8 @@ public class UnitType extends UnlockableContent{
Tmp.c1.set(Color.white).lerp(Pal.heal, Mathf.clamp(unit.healTime - unit.hitTime)); Tmp.c1.set(Color.white).lerp(Pal.heal, Mathf.clamp(unit.healTime - unit.hitTime));
Draw.mixcol(Tmp.c1, Math.max(unit.hitTime, Mathf.clamp(unit.healTime))); Draw.mixcol(Tmp.c1, Math.max(unit.hitTime, Mathf.clamp(unit.healTime)));
if(unit.drownTime > 0 && unit.floorOn().isDeep()){ if(unit.drownTime > 0 && unit.lastDrownFloor != null){
Draw.mixcol(unit.floorOn().mapColor, unit.drownTime * 0.8f); Draw.mixcol(unit.lastDrownFloor.mapColor, unit.drownTime * 0.85f);
} }
} }