From dced8834b69c9ced3d0ea7b5777ed5c0d00bd073 Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 5 Feb 2026 07:15:44 -0500 Subject: [PATCH] Fixed bridges not linking when landing --- core/src/mindustry/core/Control.java | 5 ++--- core/src/mindustry/mod/Scripts.java | 2 -- core/src/mindustry/world/Block.java | 2 ++ .../world/blocks/distribution/ItemBridge.java | 1 + core/src/mindustry/world/blocks/power/PowerNode.java | 1 + tests/src/test/java/PatcherTests.java | 10 ++++++++++ 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index c27f371b02..e2055878e6 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -31,7 +31,6 @@ import mindustry.net.*; import mindustry.type.*; import mindustry.ui.dialogs.*; import mindustry.world.*; -import mindustry.world.blocks.power.PowerNode.*; import mindustry.world.blocks.storage.CoreBlock.*; import java.io.*; @@ -245,8 +244,8 @@ public class Control implements ApplicationListener, Loadable{ float maxDelay = 0f; for(var build : state.rules.defaultTeam.data().buildings){ - //power nodes need to be configured later once everything is built - if(build instanceof PowerNodeBuild){ + //some blocks need to be configured later once everything is built + if(build.block.delayLandingConfig){ toBePlacedConfigs.add(new Object[]{build, build.config()}); } } diff --git a/core/src/mindustry/mod/Scripts.java b/core/src/mindustry/mod/Scripts.java index fdbc717c6d..2c57592c7b 100644 --- a/core/src/mindustry/mod/Scripts.java +++ b/core/src/mindustry/mod/Scripts.java @@ -46,9 +46,7 @@ public class Scripts implements Disposable{ Object o = context.evaluateString(scope, text, "console.js", 1); if(o instanceof NativeJavaObject n) o = n.unwrap(); if(o == null) o = "null"; - else if(o instanceof Undefined) o = "undefined"; - else if(o instanceof Object[] arr) o = Arrays.toString(arr); else if(o instanceof int[] arr) o = Arrays.toString(arr); else if(o instanceof float[] arr) o = Arrays.toString(arr); diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index fea0bfca8e..a55f8fa72d 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -261,6 +261,8 @@ public class Block extends UnlockableContent implements Senseable{ public int selectionRows = 5, selectionColumns = 4; /** If true, this block can be configured by logic. */ public boolean logicConfigurable = false; + /** If true, configuration is delayed when playing the landing block buildup animation. This may be removed in the future! */ + public boolean delayLandingConfig; /** Whether this block consumes touchDown events when tapped. */ public boolean consumesTap; /** Whether to draw the glow of the liquid for this block, if it has one. */ diff --git a/core/src/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/mindustry/world/blocks/distribution/ItemBridge.java index fcebb2bd77..cc963cf50e 100644 --- a/core/src/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/ItemBridge.java @@ -59,6 +59,7 @@ public class ItemBridge extends Block{ allowConfigInventory = false; ignoreResizeConfig = true; priority = TargetPriority.transport; + delayLandingConfig = true; //point2 config is relative config(Point2.class, (ItemBridgeBuild tile, Point2 i) -> tile.link = Point2.pack(i.x + tile.tileX(), i.y + tile.tileY())); diff --git a/core/src/mindustry/world/blocks/power/PowerNode.java b/core/src/mindustry/world/blocks/power/PowerNode.java index 70cb2e8433..a14cea2951 100644 --- a/core/src/mindustry/world/blocks/power/PowerNode.java +++ b/core/src/mindustry/world/blocks/power/PowerNode.java @@ -50,6 +50,7 @@ public class PowerNode extends PowerBlock{ drawDisabled = false; envEnabled |= Env.space; destructible = true; + delayLandingConfig = true; //nodes do not even need to update update = false; diff --git a/tests/src/test/java/PatcherTests.java b/tests/src/test/java/PatcherTests.java index 95cbf15e42..561f821f54 100644 --- a/tests/src/test/java/PatcherTests.java +++ b/tests/src/test/java/PatcherTests.java @@ -329,6 +329,16 @@ public class PatcherTests{ assertEquals(1, Blocks.conveyor.size); } + @Test + void assignStringToObject() throws Exception{ + Vars.state.patcher.apply(Seq.with(""" + unit.dagger.weapons: ["frog"] + """)); + + assertEquals(1, Vars.state.patcher.patches.first().warnings.size); + assertEquals(2, UnitTypes.dagger.weapons.size); + } + @Test void gibberish() throws Exception{ Vars.state.patcher.apply(Seq.with("""