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
+6 -5
View File
@@ -41,8 +41,9 @@ public class Build{
if(tile.build != null) prevBuild.add(tile.build);
tile.setBlock(sub, team, rotation);
tile.<ConstructBuild>bc().setDeconstruct(previous);
tile.<ConstructBuild>bc().prevBuild = prevBuild;
var build = (ConstructBuild)tile.build;
build.setDeconstruct(previous);
build.prevBuild = prevBuild;
tile.build.health = tile.build.maxHealth * prevPercent;
if(unit != null && unit.isPlayer()) tile.build.lastAccessed = unit.getPlayer().name;
@@ -85,7 +86,7 @@ public class Build{
tile.setBlock(sub, team, rotation);
ConstructBuild build = tile.bc();
var build = (ConstructBuild)tile.build;
build.setConstruct(previous.size == sub.size ? previous : Blocks.air, result);
build.prevBuild = prevBuild;
@@ -150,10 +151,10 @@ public class Build{
!check.floor().placeableOn || //solid wall
!((type.canReplace(check.block()) || //can replace type
//controversial change: allow rebuilding damaged blocks
//this could be buggy and abusable, so I'm not enabling it yet
//this could be buggy and abuse-able, so I'm not enabling it yet
//note that this requires a change in BuilderComp as well
//(type == check.block() && check.centerX() == x && check.centerY() == y && check.build != null && check.build.health < check.build.maxHealth - 0.0001f) ||
(check.block instanceof ConstructBlock && check.<ConstructBuild>bc().cblock == type && check.centerX() == tile.x && check.centerY() == tile.y)) && //same type in construction
(check.build instanceof ConstructBuild build && build.cblock == type && check.centerX() == tile.x && check.centerY() == tile.y)) && //same type in construction
type.bounds(tile.x, tile.y, Tmp.r1).grow(0.01f).contains(check.block.bounds(check.centerX(), check.centerY(), Tmp.r2))) || //no replacement
(type.requiresWater && check.floor().liquidDrop != Liquids.water) //requires water but none found
) return false;