Use a boolean

This commit is contained in:
MEEP of Faith
2022-08-25 10:47:18 -07:00
parent ada2c7f872
commit a29a225152
4 changed files with 14 additions and 34 deletions
-1
View File
@@ -2139,7 +2139,6 @@ unitlocate.outy = Output Y coordinate.
unitlocate.group = Building group to look for. unitlocate.group = Building group to look for.
lenum.idle = Don't move, but keep building/mining.\nThe default state. 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.stop = Stop moving/mining/building.
lenum.unbind = Completely disable logic control.\nResume standard AI. lenum.unbind = Completely disable logic control.\nResume standard AI.
lenum.move = Move to exact position. lenum.move = Move to exact position.
+4 -4
View File
@@ -1634,14 +1634,14 @@ public class LExecutor{
} }
public static class SpawnWaveI implements LInstruction{ public static class SpawnWaveI implements LInstruction{
public WaveType type; public int natural;
public int x, y; public int x, y;
public SpawnWaveI(){ public SpawnWaveI(){
} }
public SpawnWaveI(WaveType type, int x, int y){ public SpawnWaveI(int natural, int x, int y){
this.type = type; this.natural = natural;
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
@@ -1650,7 +1650,7 @@ public class LExecutor{
public void run(LExecutor exec){ public void run(LExecutor exec){
if(net.client()) return; if(net.client()) return;
if(type == WaveType.natural){ if(exec.bool(natural)){
logic.skipWave(); //TODO: Does this sync? logic.skipWave(); //TODO: Does this sync?
return; return;
} }
+10 -21
View File
@@ -1291,32 +1291,21 @@ public class LStatements{
@RegisterStatement("spawnwave") @RegisterStatement("spawnwave")
public static class SpawnWaveStatement extends LStatement{ public static class SpawnWaveStatement extends LStatement{
public WaveType type = WaveType.simulation; public String natural = "false";
public String x = "10", y = "10"; public String x = "10", y = "10";
@Override @Override
public void build(Table table){ public void build(Table table){
rebuild(table); table.add("natural ");
} fields(table, natural, str -> {
natural = str;
});
void rebuild(Table table){ table.add("x ").visible(() -> natural.equals("false"));
table.clearChildren(); fields(table, x, str -> x = str).visible(() -> natural.equals("false"));
table.button(b -> { table.add(" y ").visible(() -> natural.equals("false"));
b.label(() -> type.name()).growX().wrap().labelAlign(Align.center); fields(table, y, str -> y = str).visible(() -> natural.equals("false"));
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);
}
} }
@Override @Override
@@ -1326,7 +1315,7 @@ public class LStatements{
@Override @Override
public LInstruction build(LAssembler builder){ 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 @Override
-8
View File
@@ -1,8 +0,0 @@
package mindustry.logic;
public enum WaveType{
natural,
simulation;
public static final WaveType[] all = values();
}