diff --git a/core/src/io/anuke/mindustry/editor/MapEditor.java b/core/src/io/anuke/mindustry/editor/MapEditor.java index e5f7a9bc69..bf557eb640 100644 --- a/core/src/io/anuke/mindustry/editor/MapEditor.java +++ b/core/src/io/anuke/mindustry/editor/MapEditor.java @@ -175,7 +175,6 @@ public class MapEditor{ world.setBlock(tile(x, y), drawBlock, drawTeam); }else{ - boolean isFloor = drawBlock.isFloor() && drawBlock != Blocks.air; Consumer drawer = tile -> { diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 736b775107..49468026d1 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -281,6 +281,10 @@ public class Block extends BlockStorage{ Call.linkPowerNodes(null, tempTiles.first(), tile); } } + + if(outputsPower && !consumesPower){ + PowerNode.lastPlaced = tile.pos(); + } } public void removed(Tile tile){ diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java index 0e8d331952..94284f983c 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerNode.java @@ -25,7 +25,7 @@ import static io.anuke.mindustry.Vars.world; public class PowerNode extends PowerBlock{ //last distribution block placed - private static int lastPlaced = -1; + public static int lastPlaced = -1; protected Vector2 t1 = new Vector2(), t2 = new Vector2(); protected TextureRegion laser, laserEnd; @@ -105,19 +105,14 @@ public class PowerNode extends PowerBlock{ @Override public void playerPlaced(Tile tile){ - super.playerPlaced(tile); Tile before = world.tile(lastPlaced); - if(linkValid(tile, before) && before.block() instanceof PowerNode){ - for(Tile near : before.entity.proximity()){ - if(near == tile){ - lastPlaced = tile.pos(); - return; - } - } + + if(linkValid(tile, before) && !before.entity.proximity().contains(tile)){ Call.linkPowerNodes(null, tile, before); } lastPlaced = tile.pos(); + super.playerPlaced(tile); } @Override