Allow placing floors (for mods)
This commit is contained in:
@@ -169,6 +169,10 @@ public class Build{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(type.isFloor() && tile.floor == type){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!type.canPlaceOn(tile, team, rotation)){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,9 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
public void setFloorUnder(Floor floor){
|
||||
Block overlay = this.overlay;
|
||||
setFloor(floor);
|
||||
setOverlay(overlay);
|
||||
if(this.overlay != overlay){
|
||||
setOverlay(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
/** Sets the block to air. */
|
||||
|
||||
@@ -20,6 +20,7 @@ import mindustry.graphics.*;
|
||||
import mindustry.logic.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.blocks.storage.CoreBlock.*;
|
||||
import mindustry.world.modules.*;
|
||||
|
||||
@@ -72,7 +73,12 @@ public class ConstructBlock extends Block{
|
||||
float healthf = tile.build == null ? 1f : tile.build.healthf();
|
||||
Seq<Building> prev = tile.build instanceof ConstructBuild co ? co.prevBuild : null;
|
||||
|
||||
tile.setBlock(block, team, rotation);
|
||||
if(block instanceof Floor floor){
|
||||
tile.setFloorUnder(floor);
|
||||
tile.setBlock(Blocks.air);
|
||||
}else{
|
||||
tile.setBlock(block, team, rotation);
|
||||
}
|
||||
|
||||
if(tile.build != null){
|
||||
tile.build.health = block.health * healthf;
|
||||
|
||||
Reference in New Issue
Block a user