diff --git a/core/src/mindustry/entities/def/LegsComp.java b/core/src/mindustry/entities/def/LegsComp.java index 843d437c64..542d4d783c 100644 --- a/core/src/mindustry/entities/def/LegsComp.java +++ b/core/src/mindustry/entities/def/LegsComp.java @@ -1,5 +1,6 @@ package mindustry.entities.def; +import arc.math.*; import arc.util.*; import mindustry.annotations.Annotations.*; import mindustry.gen.*; @@ -13,7 +14,7 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc, DrawLayerGroundUnderc @Override public void update(){ if(vel().len() > 0.5f){ - baseRotation = vel().angle(); + baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed); walkTime += Time.delta()*vel().len()/1f; } } diff --git a/core/src/mindustry/entities/def/MinerComp.java b/core/src/mindustry/entities/def/MinerComp.java index 684af9fff2..5c9574085e 100644 --- a/core/src/mindustry/entities/def/MinerComp.java +++ b/core/src/mindustry/entities/def/MinerComp.java @@ -20,6 +20,7 @@ import static mindustry.Vars.*; abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc{ transient float x, y, rotation; + float mineTimer; @Nullable Tile mineTile; abstract boolean canMine(Item item); @@ -48,11 +49,14 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc{ if(mineTile == null || core == null || mineTile.block() != Blocks.air || dst(mineTile.worldx(), mineTile.worldy()) > miningRange || mineTile.drop() == null || !acceptsItem(mineTile.drop()) || !canMine(mineTile.drop())){ mineTile = null; + mineTimer = 0f; }else{ Item item = mineTile.drop(); rotation(Mathf.slerpDelta(rotation(), angleTo(mineTile.worldx(), mineTile.worldy()), 0.4f)); + mineTimer += Time.delta()*miningSpeed(); - if(Mathf.chance(Time.delta() * (0.06 - item.hardness * 0.01) * miningSpeed())){ + if(mineTimer >= 50f + item.hardness*10f){ + mineTimer = 0; if(dst(core) < mineTransferRange && core.tile().block().acceptStack(item, 1, core.tile(), this) == 1 && offloadImmediately()){ Call.transferItemTo(item, 1, diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index f457e4f24b..6669a024bb 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -163,9 +163,8 @@ public class DesktopInput extends InputHandler{ } } - //TODO implement - if(!player.dead()){ - updateKeyboard(player.unit()); + if(!player.dead() && !state.isPaused()){ + updateMovement(player.unit()); } if(Core.input.keyRelease(Binding.select)){ @@ -179,7 +178,8 @@ public class DesktopInput extends InputHandler{ if(state.is(State.menu) || Core.scene.hasDialog()) return; //zoom camera - if((!Core.scene.hasScroll() || Core.input.keyDown(Binding.diagonal_placement)) && !ui.chatfrag.shown() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!isPlacing() || !block.rotate) && selectRequests.isEmpty()))){ + if((!Core.scene.hasScroll() || Core.input.keyDown(Binding.diagonal_placement)) && !ui.chatfrag.shown() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 + && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!isPlacing() || !block.rotate) && selectRequests.isEmpty()))){ renderer.scaleCamera(Core.input.axisTap(Binding.zoom)); } @@ -494,7 +494,7 @@ public class DesktopInput extends InputHandler{ } } - protected void updateKeyboard(Unitc unit){ + protected void updateMovement(Unitc unit){ boolean canMove = !(Core.scene.getKeyboardFocus() instanceof TextField); float speed = unit.type().speed; diff --git a/core/src/mindustry/type/UnitDef.java b/core/src/mindustry/type/UnitDef.java index 847c097575..26113ac210 100644 --- a/core/src/mindustry/type/UnitDef.java +++ b/core/src/mindustry/type/UnitDef.java @@ -28,7 +28,7 @@ public class UnitDef extends UnlockableContent{ public @NonNull Prov defaultController = AIController::new; public @NonNull Prov constructor; public boolean flying; - public float speed = 1.1f, boostSpeed = 0.75f, rotateSpeed = 10f, baseRotateSpeed = 0.1f; + public float speed = 1.1f, boostSpeed = 0.75f, rotateSpeed = 10f, baseRotateSpeed = 10f; public float drag = 0.3f, mass = 1f, accel = 0.1f; public float health = 200f, range = -1; public boolean targetAir = false, targetGround = false;