This commit is contained in:
Anuken 2024-02-13 21:22:07 -05:00
parent 00ecf37276
commit 1ab8b50977
3 changed files with 16 additions and 2 deletions

View File

@ -301,6 +301,14 @@ public class MapEditor{
if(previous.in(px, py)){
tiles.set(x, y, previous.getn(px, py));
Tile tile = tiles.getn(x, y);
Object config = null;
//fetch the old config first, configs can be relative to block position (tileX/tileY) before those are reassigned
if(tile.build != null && tile.isCenter()){
config = tile.build.config();
}
tile.x = (short)x;
tile.y = (short)y;
@ -309,9 +317,12 @@ public class MapEditor{
tile.build.y = y * tilesize + tile.block().offset;
//shift links to account for map resize
Object config = tile.build.config();
if(config != null){
Object out = BuildPlan.pointConfig(tile.block(), config, p -> p.sub(offsetX, offsetY));
Object out = BuildPlan.pointConfig(tile.block(), config, p -> {
if(!tile.build.block.ignoreResizeConfig){
p.sub(offsetX, offsetY);
}
});
if(out != config){
tile.build.configureAny(out);
}

View File

@ -219,6 +219,8 @@ public class Block extends UnlockableContent implements Senseable{
public int unitCapModifier = 0;
/** Whether the block can be tapped and selected to configure. */
public boolean configurable;
/** If true, this block does not have pointConfig with a transform called on map resize. */
public boolean ignoreResizeConfig;
/** If true, this building can be selected like a unit when commanding. */
public boolean commandable;
/** If true, the building inventory can be shown with the config. */

View File

@ -45,6 +45,7 @@ public class LogicBlock extends Block{
configurable = true;
group = BlockGroup.logic;
schematicPriority = 5;
ignoreResizeConfig = true;
//universal, no real requirements
envEnabled = Env.any;