From 58e21f32b4d1445fa1b8ecd7360bfac4e0a8930b Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 2 Jul 2026 10:06:10 -0400 Subject: [PATCH] Fixed #12280 --- core/src/mindustry/world/blocks/logic/LogicBlock.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 7872afbca5..983b85c392 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -514,6 +514,7 @@ public class LogicBlock extends Block{ var cur = world.build(l.x, l.y); boolean valid = validLink(cur); + Block lastBlock = (l.lastBuild == null ? null : l.lastBuild.block); if(l.lastBuild == null) l.lastBuild = cur; if(valid != l.valid || l.lastBuild != cur){ l.lastBuild = cur; @@ -523,6 +524,13 @@ public class LogicBlock extends Block{ l.trySet(executor, null); //always clear old variable, it may get a new name if(valid){ + + if(lastBlock != null && cur.block != lastBlock){ + l.logicVar = null; //name was reassigned because block type changed, the old cached logic var is no longer relevant + l.name = ""; + l.name = findLinkName(cur.block); + } + //remove redundant links links.removeAll(o -> { boolean remove = world.build(o.x, o.y) == cur && o != l;