diff --git a/core/src/io/anuke/mindustry/content/blocks/PowerBlocks.java b/core/src/io/anuke/mindustry/content/blocks/PowerBlocks.java index 925bea179e..dab1de8033 100644 --- a/core/src/io/anuke/mindustry/content/blocks/PowerBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/PowerBlocks.java @@ -63,17 +63,13 @@ public class PowerBlocks extends BlockList implements ContentList{ health = 600; }}; - battery = new PowerDistributor("battery"){{ + battery = new Battery("battery"){{ powerCapacity = 320f; - outputsPower = true; - consumesPower = true; }}; - batteryLarge = new PowerDistributor("battery-large"){{ + batteryLarge = new Battery("battery-large"){{ size = 3; powerCapacity = 2000f; - outputsPower = true; - consumesPower = true; }}; powerNode = new PowerNode("power-node"){{ diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 51025a3286..9c3b25ad37 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -150,12 +150,18 @@ public class Block extends BaseBlock { public void powerGraphRemoved(Tile tile){ tile.entity.power.graph.remove(tile); + for(int i = 0; i < tile.entity.power.links.size; i++){ + Tile other = world.tile(tile.entity.power.links.get(i)); + if(other != null && other.entity != null && other.entity.power != null){ + other.entity.power.links.removeValue(tile.packedPosition()); + } + } } public Array getPowerConnections(Tile tile, Array out){ out.clear(); for(Tile other : tile.entity.proximity()){ - if(other.entity.power != null && !(consumesPower && other.block().consumesPower)){ + if(other.entity.power != null && !(consumesPower && other.block().consumesPower && !outputsPower && !other.block().outputsPower)){ out.add(other); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/Battery.java b/core/src/io/anuke/mindustry/world/blocks/power/Battery.java new file mode 100644 index 0000000000..48a776affb --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/power/Battery.java @@ -0,0 +1,10 @@ +package io.anuke.mindustry.world.blocks.power; + +public class Battery extends PowerDistributor{ + + public Battery(String name){ + super(name); + outputsPower = true; + consumesPower = true; + } +}