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

View File

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

View File

@@ -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);
}
}

View File

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