Fix a few issues w/ double tap mining (#4798)

Currently, double tap mining consumes clicks so it prevents the player from configuring any block if they click twice within 500ms. The double tap mining was also using the `selected` var which could have been null causing a crash. This is a very messy solution but it does the job good enough
This commit is contained in:
buthed010203 2021-02-27 10:12:00 -05:00 committed by GitHub
parent e4ecfc4ee7
commit 5037c4e00e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -491,12 +491,10 @@ public class DesktopInput extends InputHandler{
sreq = req;
}else if(req != null && req.breaking){
deleting = true;
}else if(Core.settings.getBool("doubletapmine") && selected == prevSelected && Time.timeSinceMillis(selectMillis) < 500){
tryBeginMine(selected);
}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
&& (Core.settings.getBool("doubletapmine") ? !tryStopMine(selected) : !tryBeginMine(selected)) && !Core.scene.hasKeyboard()){
&& !((!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