diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index a5114a4832..d3d22c0510 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -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()){ + && !((!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 diff --git a/core/src/mindustry/world/Tile.java b/core/src/mindustry/world/Tile.java index e5fb9cbc0d..6a4dac41b8 100644 --- a/core/src/mindustry/world/Tile.java +++ b/core/src/mindustry/world/Tile.java @@ -491,6 +491,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{ return block.solid && block.fillsTile && !block.synthetic() ? data : 0; } + /** @return true if these tiles are right next to eacho ther. */ + public boolean adjacentTo(Tile tile){ + return relativeTo(tile) != -1; + } + protected void preChanged(){ if(build != null){ //only call removed() for the center block - this only gets called once. diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 6057a513c8..ee7bea0356 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -196,10 +196,23 @@ public class PowerNode extends PowerBlock{ Boolf valid = other -> other != null && other.tile() != tile && other.power != null && (other.block.outputsPower || other.block.consumesPower || other.block instanceof PowerNode) && overlaps(tile.x * tilesize + offset, tile.y * tilesize + offset, other.tile(), laserRange * tilesize) && other.team == player.team() - && !other.proximity.contains(e -> e.tile == tile) && !graphs.contains(other.power.graph); + && !graphs.contains(other.power.graph) && + !Structs.contains(Edges.getEdges(size), p -> { //do not link to adjacent buildings + var t = world.tile(tile.x + p.x, tile.y + p.y); + return t != null && t.build == other; + }); tempTileEnts.clear(); graphs.clear(); + + //add conducting graphs to prevent double link + for(var p : Edges.getEdges(size)){ + Tile other = tile.nearby(p); + if(other != null && other.team() == player.team() && other.build != null && other.build.power != null){ + graphs.add(other.build.power.graph); + } + } + if(tile.build != null && tile.build.power != null){ graphs.add(tile.build.power.graph); }