Removed Tile#bc(), use Tile.build instead

This commit is contained in:
Anuken
2020-12-07 11:44:57 -05:00
parent 5d4b8a43e3
commit 25125f5a9b
18 changed files with 42 additions and 44 deletions
@@ -102,13 +102,11 @@ abstract class BuilderComp implements Posc, Teamc, Rotc{
}
//if there is no core to build with or no build entity, stop building!
if((core == null && !infinite) || !(tile.build instanceof ConstructBuild)){
if((core == null && !infinite) || !(tile.build instanceof ConstructBuild entity)){
return;
}
//otherwise, update it.
ConstructBuild entity = tile.bc();
if(current.breaking){
entity.deconstruct(self(), core, 1f / entity.buildCost * Time.delta * type.buildSpeed * state.rules.buildSpeedMultiplier);
}else{
@@ -182,8 +180,8 @@ abstract class BuilderComp implements Posc, Teamc, Rotc{
plans.remove(replace);
}
Tile tile = world.tile(place.x, place.y);
if(tile != null && tile.build instanceof ConstructBuild){
place.progress = tile.<ConstructBuild>bc().progress;
if(tile != null && tile.build instanceof ConstructBuild cons){
place.progress = cons.progress;
}
if(tail){
plans.addLast(place);
@@ -201,7 +201,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(self() instanceof ConstructBuild entity){
//update block to reflect the fact that something was being constructed
if(entity.cblock != null && entity.cblock.synthetic()){
if(entity.cblock != null && entity.cblock.synthetic() && entity.wasConstructing){
block = entity.cblock;
}else{
//otherwise this was a deconstruction that was interrupted, don't want to rebuild that