From a29a2251526da5091286bc7452f61f6c22426d8c Mon Sep 17 00:00:00 2001 From: MEEP of Faith Date: Thu, 25 Aug 2022 10:47:18 -0700 Subject: [PATCH] Use a boolean --- core/assets/bundles/bundle.properties | 1 - core/src/mindustry/logic/LExecutor.java | 8 +++--- core/src/mindustry/logic/LStatements.java | 31 ++++++++--------------- core/src/mindustry/logic/WaveType.java | 8 ------ 4 files changed, 14 insertions(+), 34 deletions(-) delete mode 100644 core/src/mindustry/logic/WaveType.java diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 0d4e1af00f..15da711f49 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -2139,7 +2139,6 @@ unitlocate.outy = Output Y coordinate. unitlocate.group = Building group to look for. lenum.idle = Don't move, but keep building/mining.\nThe default state. -lenum.simulation = Will not increment the wave counter. lenum.stop = Stop moving/mining/building. lenum.unbind = Completely disable logic control.\nResume standard AI. lenum.move = Move to exact position. diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 16a0e7012c..eaf4036c9d 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -1634,14 +1634,14 @@ public class LExecutor{ } public static class SpawnWaveI implements LInstruction{ - public WaveType type; + public int natural; public int x, y; public SpawnWaveI(){ } - public SpawnWaveI(WaveType type, int x, int y){ - this.type = type; + public SpawnWaveI(int natural, int x, int y){ + this.natural = natural; this.x = x; this.y = y; } @@ -1650,7 +1650,7 @@ public class LExecutor{ public void run(LExecutor exec){ if(net.client()) return; - if(type == WaveType.natural){ + if(exec.bool(natural)){ logic.skipWave(); //TODO: Does this sync? return; } diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 4cc4b0cc8e..97c6cf7003 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -1291,32 +1291,21 @@ public class LStatements{ @RegisterStatement("spawnwave") public static class SpawnWaveStatement extends LStatement{ - public WaveType type = WaveType.simulation; + public String natural = "false"; public String x = "10", y = "10"; @Override public void build(Table table){ - rebuild(table); - } + table.add("natural "); + fields(table, natural, str -> { + natural = str; + }); - void rebuild(Table table){ - table.clearChildren(); + table.add("x ").visible(() -> natural.equals("false")); + fields(table, x, str -> x = str).visible(() -> natural.equals("false")); - table.button(b -> { - b.label(() -> type.name()).growX().wrap().labelAlign(Align.center); - b.clicked(() -> showSelect(b, WaveType.all, type, o -> { - type = o; - rebuild(table); - }, 1, c -> c.width(150f))); - }, Styles.logict, () -> {}).size(160f, 40f).padLeft(2).color(table.color); - - if(type == WaveType.simulation){ - table.add("x "); - fields(table, x, str -> x = str); - - table.add(" y "); - fields(table, y, str -> y = str); - } + table.add(" y ").visible(() -> natural.equals("false")); + fields(table, y, str -> y = str).visible(() -> natural.equals("false")); } @Override @@ -1326,7 +1315,7 @@ public class LStatements{ @Override public LInstruction build(LAssembler builder){ - return new SpawnWaveI(type, builder.var(x), builder.var(y)); + return new SpawnWaveI(builder.var(natural), builder.var(x), builder.var(y)); } @Override diff --git a/core/src/mindustry/logic/WaveType.java b/core/src/mindustry/logic/WaveType.java deleted file mode 100644 index a1741481d7..0000000000 --- a/core/src/mindustry/logic/WaveType.java +++ /dev/null @@ -1,8 +0,0 @@ -package mindustry.logic; - -public enum WaveType{ - natural, - simulation; - - public static final WaveType[] all = values(); -}