Use a boolean
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package mindustry.logic;
|
||||
|
||||
public enum WaveType{
|
||||
natural,
|
||||
simulation;
|
||||
|
||||
public static final WaveType[] all = values();
|
||||
}
|
||||
Reference in New Issue
Block a user