From 19f34c14a07c71db56f94b3e262c09c34961cea5 Mon Sep 17 00:00:00 2001 From: Anuken Date: Tue, 8 Aug 2023 09:29:20 -0400 Subject: [PATCH] Fixed #8904 --- core/src/mindustry/logic/LogicDialog.java | 9 +++++++++ core/src/mindustry/world/blocks/logic/LogicBlock.java | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/mindustry/logic/LogicDialog.java b/core/src/mindustry/logic/LogicDialog.java index ac2fd249a8..67ae4c40c7 100644 --- a/core/src/mindustry/logic/LogicDialog.java +++ b/core/src/mindustry/logic/LogicDialog.java @@ -228,11 +228,20 @@ public class LogicDialog extends BaseDialog{ } public void show(String code, LExecutor executor, boolean privileged, Cons modified){ + show(code, executor, privileged, null, modified); + } + + public void show(String code, LExecutor executor, boolean privileged, @Nullable Building build, Cons modified){ this.executor = executor; this.privileged = privileged; canvas.statements.clearChildren(); canvas.rebuild(); canvas.privileged = privileged; + update(() -> { + if(build != null && (!build.isValid() || !state.isGame())){ + hide(); + } + }); try{ canvas.load(code); }catch(Throwable t){ diff --git a/core/src/mindustry/world/blocks/logic/LogicBlock.java b/core/src/mindustry/world/blocks/logic/LogicBlock.java index 7805e6830b..8920cd2526 100644 --- a/core/src/mindustry/world/blocks/logic/LogicBlock.java +++ b/core/src/mindustry/world/blocks/logic/LogicBlock.java @@ -577,7 +577,7 @@ public class LogicBlock extends Block{ @Override public void buildConfiguration(Table table){ table.button(Icon.pencil, Styles.cleari, () -> { - ui.logic.show(code, executor, privileged, code -> configure(compress(code, relativeConnections()))); + ui.logic.show(code, executor, privileged, this, code -> configure(compress(code, relativeConnections()))); }).size(40); }