Added allowRectanglePlacement for 1x1 blocks
This commit is contained in:
@@ -245,6 +245,8 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
public boolean allowDiagonal = true;
|
||||
/** Whether to swap the diagonal placement modes. */
|
||||
public boolean swapDiagonalPlacement;
|
||||
/** Whether to allow rectangular placement, as opposed to a line. Only supported for 1x1 blocks currently! */
|
||||
public boolean allowRectanglePlacement = false;
|
||||
/** Build queue priority in schematics. */
|
||||
public int schematicPriority = 0;
|
||||
/**
|
||||
@@ -322,6 +324,8 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
public float deconstructThreshold = 0f;
|
||||
/** If true, this block deconstructs immediately. Instant deconstruction implies no resource refund. */
|
||||
public boolean instantDeconstruct = false;
|
||||
/** If true, this block constructs immediately. This implies no resource requirement, and ignores configs - do not use, this is for performance only! */
|
||||
public boolean instantBuild = false;
|
||||
/** Effect for placing the block. Passes size as rotation. */
|
||||
public Effect placeEffect = Fx.placeBlock;
|
||||
/** Effect for breaking the block. Passes size as rotation. */
|
||||
|
||||
@@ -122,6 +122,14 @@ public class Build{
|
||||
}
|
||||
});
|
||||
|
||||
//complete it immediately
|
||||
if(result.instantBuild){
|
||||
Events.fire(new BlockBuildBeginEvent(tile, team, unit, false));
|
||||
result.placeBegan(tile, tile.block, unit);
|
||||
ConstructBlock.constructFinish(tile, result, unit, (byte)rotation, team, null);
|
||||
return;
|
||||
}
|
||||
|
||||
Block previous = tile.block();
|
||||
Block sub = ConstructBlock.get(result.size);
|
||||
var prevBuild = new Seq<Building>(9);
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ConstructBlock extends Block{
|
||||
tile.setBlock(block, team, rotation);
|
||||
}
|
||||
|
||||
if(tile.build != null){
|
||||
if(tile.build != null && tile.build.block == block){
|
||||
tile.build.health = block.health * healthf;
|
||||
|
||||
if(config != null){
|
||||
@@ -100,11 +100,11 @@ public class ConstructBlock extends Block{
|
||||
|
||||
//make sure block indexer knows it's damaged
|
||||
indexer.notifyHealthChanged(tile.build);
|
||||
}
|
||||
|
||||
//last builder was this local client player, call placed()
|
||||
if(tile.build != null && !headless && builder == player.unit()){
|
||||
tile.build.playerPlaced(config);
|
||||
//last builder was this local client player, call placed()
|
||||
if(!headless && builder == player.unit()){
|
||||
tile.build.playerPlaced(config);
|
||||
}
|
||||
}
|
||||
|
||||
if(fogControl.isVisibleTile(team, tile.x, tile.y)){
|
||||
|
||||
@@ -90,6 +90,8 @@ public class Floor extends Block{
|
||||
super(name);
|
||||
this.variants = variants;
|
||||
placeableLiquid = true;
|
||||
allowRectanglePlacement = true;
|
||||
instantBuild = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,6 +20,8 @@ public class StaticWall extends Prop{
|
||||
solid = true;
|
||||
variants = 2;
|
||||
cacheLayer = CacheLayer.walls;
|
||||
allowRectanglePlacement = true;
|
||||
instantBuild = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user