Desktop double-click mining: fix click on mined tile to cancel (#4815)

This commit is contained in:
Joshua Fan 2021-02-28 06:19:27 -08:00 committed by GitHub
parent 666c0f3582
commit c55ff4ad5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -494,7 +494,7 @@ public class DesktopInput extends InputHandler{
}else if(selected != null){
//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
&& !((!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;
}
}else if(!Core.scene.hasKeyboard()){ //if it's out of bounds, shooting is just fine

View File

@ -948,8 +948,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
/** Tries to begin mining a tile, returns true if successful. */
boolean tryBeginMine(Tile tile){
if(canMine(tile)){
//if a block is clicked twice, reset it
player.unit().mineTile = player.unit().mineTile == tile ? null : tile;
player.unit().mineTile = tile;
return true;
}
return false;