From 1ab8b509773ecc2cd75e8ab5db3d8fa107ab0700 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 13 Feb 2024 21:22:07 -0500 Subject: [PATCH] Fixed #9548 --- core/src/mindustry/editor/MapEditor.java | 15 +++++++++++++-- core/src/mindustry/world/Block.java | 2 ++ .../mindustry/world/blocks/logic/LogicBlock.java | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/src/mindustry/editor/MapEditor.java b/core/src/mindustry/editor/MapEditor.java index 96418def2f..37a10cca89 100644 --- a/core/src/mindustry/editor/MapEditor.java +++ b/core/src/mindustry/editor/MapEditor.java @@ -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); } diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index 3f8a1fdc22..a401c896a7 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -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. */ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 765186cce1..3b5abe456e 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -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;