Upgradeable cores

This commit is contained in:
Anuken
2020-06-27 19:16:39 -04:00
parent 313cadb763
commit 80332e37d5
63 changed files with 365 additions and 290 deletions

View File

@@ -89,8 +89,8 @@ public class BlockIndexer{
for(Tile tile : world.tiles){
process(tile);
if(tile.entity != null && tile.entity.damaged()){
notifyTileDamaged(tile.entity);
if(tile.build != null && tile.build.damaged()){
notifyTileDamaged(tile.build);
}
if(tile.drop() != null) allOres.add(tile.drop());
@@ -147,7 +147,7 @@ public class BlockIndexer{
TileArray set = damagedTiles[team.id];
for(Tile tile : set){
if((tile.entity == null || tile.entity.team() != team || !tile.entity.damaged()) || tile.block() instanceof BuildBlock){
if((tile.build == null || tile.build.team() != team || !tile.build.damaged()) || tile.block() instanceof BuildBlock){
returnArray.add(tile);
}
}
@@ -380,7 +380,7 @@ public class BlockIndexer{
GridBits bits = structQuadrant(team);
//fast-set this quadrant to 'occupied' if the tile just placed is already of this team
if(tile.team() == team && tile.entity != null && tile.block().targetable){
if(tile.team() == team && tile.build != null && tile.block().targetable){
bits.set(quadrantX, quadrantY);
continue; //no need to process futher
}

View File

@@ -27,7 +27,7 @@ public class BuilderAI extends AIController{
BuildPlan req = builder.buildPlan();
boolean valid =
(req.tile().entity instanceof BuildEntity && req.tile().<BuildEntity>ent().cblock == req.block) ||
(req.tile().build instanceof BuildEntity && req.tile().<BuildEntity>bc().cblock == req.block) ||
(req.breaking ?
Build.validBreak(unit.team(), req.x, req.y) :
Build.validPlace(req.block, unit.team(), req.x, req.y, req.rotation));

View File

@@ -38,8 +38,8 @@ public class SuicideAI extends GroundAI{
//raycast for target
boolean blocked = Vars.world.raycast(unit.tileX(), unit.tileY(), target.tileX(), target.tileY(), (x, y) -> {
Tile tile = Vars.world.tile(x, y);
if(tile != null && tile.entity == target) return false;
if(tile != null && tile.entity != null && tile.entity.team() != unit.team()){
if(tile != null && tile.build == target) return false;
if(tile != null && tile.build != null && tile.build.team() != unit.team()){
blockedByBlock = true;
return true;
}else{