From 9521af7be5e52956648074cc833bdb353d2cf359 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 19 Jul 2020 13:00:55 -0400 Subject: [PATCH] Input fixes --- core/src/mindustry/input/DesktopInput.java | 4 ++++ core/src/mindustry/input/MobileInput.java | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 76f983965d..bb3970a71e 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -576,6 +576,10 @@ public class DesktopInput extends InputHandler{ boolean boosted = (unit instanceof Mechc && unit.isFlying()); movement.set(xa, ya).nor().scl(speed); + if(Core.input.keyDown(Binding.mouse_move)){ + movement.add(input.mouseWorld().sub(player).scl(1f / 25f * speed)).limit(speed); + } + float mouseAngle = Angles.mouseAngle(unit.x, unit.y); boolean aimCursor = omni && player.shooting && unit.type().hasWeapons() && unit.type().faceTarget && !boosted && unit.type().rotateShooting; diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index a418e64f99..7f61008385 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -422,6 +422,7 @@ public class MobileInput extends InputHandler implements GestureListener{ lastSchematic = schem; } + @Override public boolean touchDown(int screenX, int screenY, int pointer, KeyCode button){ if(state.isMenu()) return false; @@ -568,8 +569,16 @@ public class MobileInput extends InputHandler implements GestureListener{ }else if(mode == breaking && validBreak(linked.x,linked.y) && !hasRequest(linked)){ //add to selection queue if it's a valid BREAK position selectRequests.add(new BuildPlan(linked.x, linked.y)); - }else if(!canTapPlayer(worldx, worldy) && !tileTapped(linked.build)){ - tryBeginMine(cursor); + }else{ + if(!canTapPlayer(worldx, worldy) && !tileTapped(linked.build)){ + tryBeginMine(cursor); + } + + //apply command on double tap + if(count == 2 && Mathf.within(worldx, worldy, player.unit().x, player.unit().y, player.unit().hitSize * 2f) && + player.unit() instanceof Commanderc){ + Call.unitCommand(player); + } } return false;