diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 1d8b65cbca..bcedc0e4d6 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -268,11 +268,12 @@ public class Blocks implements ContentList{ }}; ice = new Floor("ice"){{ - dragMultiplier = 0.6f; + dragMultiplier = 0.35f; attributes.set(Attribute.water, 0.4f); }}; iceSnow = new Floor("ice-snow"){{ + dragMultiplier = 0.6f; variants = 3; attributes.set(Attribute.water, 0.3f); }}; diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 5f68deb5eb..fb96da5e09 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -22,8 +22,8 @@ public class UnitTypes implements ContentList{ public void load(){ dagger = new UnitDef("dagger"){{ - speed = 0.2f; - drag = 0.2f; + speed = 1f; + drag = 0.3f; hitsize = 8f; mass = 1.75f; health = 130; @@ -37,7 +37,7 @@ public class UnitTypes implements ContentList{ }}; vanguard = new UnitDef("vanguard"){{ - speed = 0.3f; + speed = 1.3f; drag = 0.1f; hitsize = 8f; mass = 1.75f; diff --git a/core/src/mindustry/entities/def/FlyingComp.java b/core/src/mindustry/entities/def/FlyingComp.java index f5035ab55e..9e21a61d3e 100644 --- a/core/src/mindustry/entities/def/FlyingComp.java +++ b/core/src/mindustry/entities/def/FlyingComp.java @@ -4,6 +4,7 @@ import arc.math.*; import arc.math.geom.*; import arc.util.*; import mindustry.annotations.Annotations.*; +import mindustry.content.*; import mindustry.gen.*; import mindustry.world.blocks.*; @@ -30,6 +31,19 @@ abstract class FlyingComp implements Posc, Velc, Healthc, Hitboxc{ return isGrounded(); } + void moveAt(Vec2 vector){ + Floor on = isFlying() ? Blocks.air.asFloor() : floorOn(); + Vec2 t = Tmp.v3.set(vector).scl(floorSpeedMultiplier()); //target vector + float mag = Tmp.v3.len(); + vel.x = Mathf.approach(vel.x, t.x, mag); + vel.y = Mathf.approach(vel.y, t.y, mag); + } + + float floorSpeedMultiplier(){ + Floor on = isFlying() ? Blocks.air.asFloor() : floorOn(); + return on.speedMultiplier; + } + @Override public void update(){ Floor floor = floorOn(); diff --git a/core/src/mindustry/entities/def/MassComp.java b/core/src/mindustry/entities/def/MassComp.java index e9f06aa9bc..13ec0c2b9d 100644 --- a/core/src/mindustry/entities/def/MassComp.java +++ b/core/src/mindustry/entities/def/MassComp.java @@ -7,7 +7,7 @@ import mindustry.gen.*; abstract class MassComp implements Velc{ float mass = 1f; - public void applyImpulse(float x, float y){ + public void impulse(float x, float y){ vel().add(x / mass, y / mass); } } diff --git a/core/src/mindustry/entities/def/UnitComp.java b/core/src/mindustry/entities/def/UnitComp.java index f20a23a01b..9550b7261a 100644 --- a/core/src/mindustry/entities/def/UnitComp.java +++ b/core/src/mindustry/entities/def/UnitComp.java @@ -83,6 +83,8 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox @Override public void update(){ + drag(type.drag * (isGrounded() ? (floorOn().dragMultiplier) : 1f)); + //apply knockback based on spawns //TODO move elsewhere if(team() != state.rules.waveTeam){ diff --git a/core/src/mindustry/entities/def/WaterMoveComp.java b/core/src/mindustry/entities/def/WaterMoveComp.java index ddef3d2acb..a5d44f1239 100644 --- a/core/src/mindustry/entities/def/WaterMoveComp.java +++ b/core/src/mindustry/entities/def/WaterMoveComp.java @@ -1,8 +1,10 @@ package mindustry.entities.def; import mindustry.annotations.Annotations.*; +import mindustry.content.*; import mindustry.entities.*; import mindustry.gen.*; +import mindustry.world.blocks.*; import static mindustry.Vars.collisions; @@ -29,5 +31,11 @@ abstract class WaterMoveComp implements Posc, Velc, Hitboxc, Flyingc{ public boolean canDrown(){ return false; } + + @Replace + public float floorSpeedMultiplier(){ + Floor on = isFlying() ? Blocks.air.asFloor() : floorOn(); + return on.isDeep() ? 1.3f : 1f; + } } diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 9d140ce8e9..88d9608321 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -504,11 +504,11 @@ public class DesktopInput extends InputHandler{ Vec2 movement = Tmp.v1.set(speed * xa, speed * ya).limit(speed); if(omni){ - unit.vel().add(movement); + unit.moveAt(movement); unit.lookAt(Angles.mouseAngle(unit.x(), unit.y())); }else{ if(!unit.vel().isZero(0.01f)) unit.rotation(unit.vel().angle()); - unit.vel().add(Tmp.v2.trns(unit.rotation(), movement.len())); + unit.moveAt(Tmp.v2.trns(unit.rotation(), movement.len())); if(!movement.isZero()) unit.vel().rotateTo(movement.angle(), unit.type().rotateSpeed * Time.delta()); } diff --git a/core/src/mindustry/world/blocks/distribution/Conveyor.java b/core/src/mindustry/world/blocks/distribution/Conveyor.java index 732c013a9e..4f60d5a319 100644 --- a/core/src/mindustry/world/blocks/distribution/Conveyor.java +++ b/core/src/mindustry/world/blocks/distribution/Conveyor.java @@ -162,7 +162,7 @@ public class Conveyor extends Block implements Autotiler{ } if(entity.len * itemSpace < 0.9f){ - unit.applyImpulse((tx * speed + centerx) * entity.delta(), (ty * speed + centery) * entity.delta()); + unit.impulse((tx * speed + centerx) * entity.delta(), (ty * speed + centery) * entity.delta()); } } diff --git a/gradle.properties b/gradle.properties index 4aabb4e9b4..ae5c619f0d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.daemon=true org.gradle.jvmargs=-Xms256m -Xmx1024m -archash=b2996f736d5b6870913f5d8b5496fe6033069ac8 +archash=0328073f1993cd1d72a237781c3cc1f82395234b