diff --git a/core/src/io/anuke/mindustry/entities/TileEntity.java b/core/src/io/anuke/mindustry/entities/TileEntity.java index a484dc3e6c..7fbbab0ac4 100644 --- a/core/src/io/anuke/mindustry/entities/TileEntity.java +++ b/core/src/io/anuke/mindustry/entities/TileEntity.java @@ -157,6 +157,9 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{ } public void removeFromProximity(){ + if(power != null){ + tile.block().powerGraphRemoved(tile); + } GridPoint2[] nearby = Edges.getEdges(tile.block().size); for(GridPoint2 point : nearby){ Tile other = world.tile(tile.x + point.x, tile.y + point.y); diff --git a/core/src/io/anuke/mindustry/world/Block.java b/core/src/io/anuke/mindustry/world/Block.java index 6995ed27d9..20422dceeb 100644 --- a/core/src/io/anuke/mindustry/world/Block.java +++ b/core/src/io/anuke/mindustry/world/Block.java @@ -159,6 +159,10 @@ public class Block extends BaseBlock { } } + public void powerGraphRemoved(Tile tile){ + tile.entity.power.graph.remove(tile); + } + public boolean isLayer(Tile tile){ return true; } diff --git a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java index a5f9588400..536c4430c5 100644 --- a/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java +++ b/core/src/io/anuke/mindustry/world/blocks/power/PowerGraph.java @@ -66,7 +66,7 @@ public class PowerGraph{ } public void remove(Tile tile){ - all.add(tile); + all.remove(tile); producers.remove(tile); consumers.remove(tile); }