From 18bb7ba9366732738fca8cf80caafcade1e013f9 Mon Sep 17 00:00:00 2001 From: joshuaptfan Date: Sun, 15 Dec 2019 14:26:13 -0800 Subject: [PATCH] Prevent right-click from deconstructing when schematic is selected; allow deconstruct cancel with left-click --- .../io/anuke/mindustry/input/DesktopInput.java | 16 ++++++++-------- .../io/anuke/mindustry/input/MobileInput.java | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/io/anuke/mindustry/input/DesktopInput.java b/core/src/io/anuke/mindustry/input/DesktopInput.java index bc9536f360..cf7b3de6d5 100644 --- a/core/src/io/anuke/mindustry/input/DesktopInput.java +++ b/core/src/io/anuke/mindustry/input/DesktopInput.java @@ -150,7 +150,7 @@ public class DesktopInput extends InputHandler{ if(state.is(State.menu) || Core.scene.hasDialog()) return; //zoom camera - if(!Core.scene.hasScroll() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((block == null || !block.rotate) && selectRequests.isEmpty()))){ + if(!Core.scene.hasScroll() && 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)); } @@ -166,11 +166,6 @@ public class DesktopInput extends InputHandler{ mode = none; } - if(mode != none || isPlacing()){ - selectRequests.clear(); - lastSchematic = null; - } - if(player.isShooting && !canShoot()){ player.isShooting = false; } @@ -354,7 +349,9 @@ public class DesktopInput extends InputHandler{ if(Core.input.keyTap(Binding.select) && !Core.scene.hasMouse()){ BuildRequest req = getRequest(cursorX, cursorY); - if(!selectRequests.isEmpty()){ + if(Core.input.keyDown(Binding.break_block)){ + mode = none; + }else if(!selectRequests.isEmpty()){ flushRequests(selectRequests); }else if(isPlacing()){ selectX = cursorX; @@ -376,9 +373,12 @@ public class DesktopInput extends InputHandler{ }else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine player.isShooting = true; } - }else if(Core.input.keyTap(Binding.deselect) && block != null){ + }else if(Core.input.keyTap(Binding.deselect) && isPlacing()){ block = null; mode = none; + }else if(Core.input.keyTap(Binding.deselect) && !selectRequests.isEmpty()){ + selectRequests.clear(); + lastSchematic = null; }else if(Core.input.keyTap(Binding.break_block) && !Core.scene.hasMouse()){ //is recalculated because setting the mode to breaking removes potential multiblock cursor offset deleting = false; diff --git a/core/src/io/anuke/mindustry/input/MobileInput.java b/core/src/io/anuke/mindustry/input/MobileInput.java index 26cf3fcd09..b057156719 100644 --- a/core/src/io/anuke/mindustry/input/MobileInput.java +++ b/core/src/io/anuke/mindustry/input/MobileInput.java @@ -588,7 +588,7 @@ public class MobileInput extends InputHandler implements GestureListener{ } //zoom camera - if(Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((block == null || !block.rotate) && selectRequests.isEmpty()))){ + if(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)); }