From 8fb7aa34e3da5732e465c818b06d5f0e3f2f3b9d Mon Sep 17 00:00:00 2001 From: Anuken Date: Sat, 27 Dec 2025 21:42:22 -0500 Subject: [PATCH] Cleanup --- core/src/mindustry/content/Blocks.java | 2 ++ core/src/mindustry/game/Rules.java | 2 +- core/src/mindustry/logic/LExecutor.java | 2 +- .../mindustry/world/blocks/logic/LogicDisplay.java | 11 +++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index fd3cd223ca..2c5d3b751d 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -6646,11 +6646,13 @@ public class Blocks{ liquidSource = new LiquidSource("liquid-source"){{ requirements(Category.liquid, BuildVisibility.sandboxOnly, with()); alwaysUnlocked = true; + floating = true; }}; liquidVoid = new LiquidVoid("liquid-void"){{ requirements(Category.liquid, BuildVisibility.sandboxOnly, with()); alwaysUnlocked = true; + floating = true; }}; payloadSource = new PayloadSource("payload-source"){{ diff --git a/core/src/mindustry/game/Rules.java b/core/src/mindustry/game/Rules.java index 2697a1d8b1..e633265a4e 100644 --- a/core/src/mindustry/game/Rules.java +++ b/core/src/mindustry/game/Rules.java @@ -64,7 +64,7 @@ public class Rules{ public boolean fire = true; /** Whether units use and require ammo. */ public boolean unitAmmo = false; - /** EXPERIMENTAL! If true, air and ground units target random things each wave instead of only the core/generators. */ + /** If true, air and ground units target random things each wave instead of only the core/generators. */ public boolean randomWaveAI = false; /** EXPERIMENTAL! If true, blocks will update in units and share power. */ public boolean unitPayloadUpdate = false; diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 1ddd2cecaf..dba0aa50ca 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -950,7 +950,7 @@ public class LExecutor{ if(p1.obj() instanceof UnlockableContent u){ packed = (u.id << 5) | (u.getContentType().ordinal() & 31); }else if(p1.obj() instanceof LogicDisplayBuild d){ - packed = (d.index << 5) | 30; + packed = (d.index << 5) | LogicDisplay.displayDrawType; } num1 = packed & 0x3FF; num4 = packed >> 10; diff --git a/core/src/mindustry/world/blocks/logic/LogicDisplay.java b/core/src/mindustry/world/blocks/logic/LogicDisplay.java index 6a851342f7..2b65768cb0 100644 --- a/core/src/mindustry/world/blocks/logic/LogicDisplay.java +++ b/core/src/mindustry/world/blocks/logic/LogicDisplay.java @@ -11,6 +11,7 @@ import arc.util.io.*; import mindustry.*; import mindustry.annotations.Annotations.*; import mindustry.ctype.*; +import mindustry.game.EventType.*; import mindustry.gen.*; import mindustry.graphics.*; import mindustry.logic.*; @@ -42,6 +43,8 @@ public class LogicDisplay extends Block{ ; public static final Seq displays = new Seq<>(false); + /** When the content type of a draw command is this number, it counts as a display. */ + public static final int displayDrawType = 30; public static final float scaleStep = 0.05f; @@ -50,6 +53,10 @@ public class LogicDisplay extends Block{ public int displaySize = 64; public float scaleFactor = 1f; + static{ + Events.on(ResetEvent.class, e -> displays.clear()); + } + public LogicDisplay(String name){ super(name); update = true; @@ -173,8 +180,8 @@ public class LogicDisplay extends Block{ int packed = (DisplayCmd.p4(c) << 10) | DisplayCmd.p1(c); int ctype = packed & 0x1F; int id = packed >> 5; - if(ctype == 30){ - if(id != index && id < displays.size && displays.get(id).buffer != null){ + if(ctype == displayDrawType){ + if(id != index && id < displays.size && id >= 0 && displays.get(id).buffer != null){ Tmp.tr1.set(displays.get(id).buffer.getTexture()); Draw.rect(Tmp.tr1, x, y, p2, p2, p3 + 90); }