Power graph removal

This commit is contained in:
Anuken
2018-09-18 17:04:43 -04:00
parent 8c7258e839
commit 33418397f8
3 changed files with 8 additions and 1 deletions

View File

@@ -157,6 +157,9 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
} }
public void removeFromProximity(){ public void removeFromProximity(){
if(power != null){
tile.block().powerGraphRemoved(tile);
}
GridPoint2[] nearby = Edges.getEdges(tile.block().size); GridPoint2[] nearby = Edges.getEdges(tile.block().size);
for(GridPoint2 point : nearby){ for(GridPoint2 point : nearby){
Tile other = world.tile(tile.x + point.x, tile.y + point.y); Tile other = world.tile(tile.x + point.x, tile.y + point.y);

View File

@@ -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){ public boolean isLayer(Tile tile){
return true; return true;
} }

View File

@@ -66,7 +66,7 @@ public class PowerGraph{
} }
public void remove(Tile tile){ public void remove(Tile tile){
all.add(tile); all.remove(tile);
producers.remove(tile); producers.remove(tile);
consumers.remove(tile); consumers.remove(tile);
} }