Power graph initial commit

This commit is contained in:
Anuken
2018-09-12 18:35:29 -04:00
parent 7b4e6128ce
commit abd87793e4
8 changed files with 69 additions and 64 deletions

View File

@@ -179,19 +179,19 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
for(GridPoint2 point : nearby){
Tile other = world.tile(tile.x + point.x, tile.y + point.y);
if(other != null){
other.block().onProximityUpdate(other);
other = other.target();
if(other == null || other.entity == null || other.getTeamID() != tile.getTeamID()) continue;
other = other.target();
if(other.entity.power != null) other.block().updatePowerGraph(other);
other.block().onProximityUpdate(other);
tmpTiles.add(other);
//add this tile to proximity of nearby tiles
if(!other.entity.proximity.contains(tile, true)){
other.entity.proximity.add(tile);
}
if(other != null && other.entity != null){
tmpTiles.add(other);
//add this tile to proximity of nearby tiles
if(!other.entity.proximity.contains(tile, true)){
other.entity.proximity.add(tile);
}
}
}
//using a set to prevent duplicates
@@ -199,6 +199,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
proximity.add(tile);
}
if(power != null) tile.block().updatePowerGraph(tile);
tile.block().onProximityUpdate(tile);
}