mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 03:20:32 +07:00
Desktop double-click mining: fix click on mined tile to cancel (#4815)
This commit is contained in:
parent
666c0f3582
commit
c55ff4ad5e
@ -494,7 +494,7 @@ public class DesktopInput extends InputHandler{
|
|||||||
}else if(selected != null){
|
}else if(selected != null){
|
||||||
//only begin shooting if there's no cursor event
|
//only begin shooting if there's no cursor event
|
||||||
if(!tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && !tileTapped(selected.build) && !player.unit().activelyBuilding() && !droppingItem
|
if(!tryTapPlayer(Core.input.mouseWorld().x, Core.input.mouseWorld().y) && !tileTapped(selected.build) && !player.unit().activelyBuilding() && !droppingItem
|
||||||
&& !((!settings.getBool("doubletapmine") || (selected == prevSelected && Time.timeSinceMillis(selectMillis) < 500)) && tryBeginMine(selected)) && !Core.scene.hasKeyboard()){
|
&& !(tryStopMine(selected) || (!settings.getBool("doubletapmine") || selected == prevSelected && Time.timeSinceMillis(selectMillis) < 500) && tryBeginMine(selected)) && !Core.scene.hasKeyboard()){
|
||||||
player.shooting = shouldShoot;
|
player.shooting = shouldShoot;
|
||||||
}
|
}
|
||||||
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine
|
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine
|
||||||
|
@ -948,8 +948,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
/** Tries to begin mining a tile, returns true if successful. */
|
/** Tries to begin mining a tile, returns true if successful. */
|
||||||
boolean tryBeginMine(Tile tile){
|
boolean tryBeginMine(Tile tile){
|
||||||
if(canMine(tile)){
|
if(canMine(tile)){
|
||||||
//if a block is clicked twice, reset it
|
player.unit().mineTile = tile;
|
||||||
player.unit().mineTile = player.unit().mineTile == tile ? null : tile;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user