Closes Anuken/Mindustry-Suggestions/issues/4703

This commit is contained in:
Anuken
2023-10-01 18:47:37 -04:00
parent 4c704b9366
commit e9a801bcef
2 changed files with 15 additions and 7 deletions

View File

@@ -1883,13 +1883,14 @@ public class LExecutor{
public static final int maxMarkers = 20000;
public String type = "shape";
public int id, x, y;
public int id, x, y, replace;
public MakeMarkerI(String type, int id, int x, int y){
public MakeMarkerI(String type, int id, int x, int y, int replace){
this.type = type;
this.id = id;
this.x = x;
this.y = y;
this.replace = replace;
}
public MakeMarkerI(){
@@ -1900,9 +1901,12 @@ public class LExecutor{
var cons = MapObjectives.markerNameToType.get(type);
if(cons != null && state.markers.size < maxMarkers){
var marker = cons.get();
marker.control(LMarkerControl.pos, exec.num(x), exec.num(y), 0);
state.markers.put(exec.numi(id), marker);
int mid = exec.numi(id);
if(exec.bool(replace) || !state.markers.containsKey(mid)){
var marker = cons.get();
marker.control(LMarkerControl.pos, exec.num(x), exec.num(y), 0);
state.markers.put(mid, marker);
}
}
}
}

View File

@@ -1982,7 +1982,7 @@ public class LStatements{
@RegisterStatement("makemarker")
public static class MakeMarkerStatement extends LStatement{
public String id = "0", type = "shape", x = "0", y = "0";
public String id = "0", type = "shape", x = "0", y = "0", replace = "true";
@Override
public void build(Table table){
@@ -2004,6 +2004,10 @@ public class LStatements{
fieldst(table, "x", x, v -> x = v);
fieldst(table, "y", y, v -> y = v);
row(table);
fieldst(table, "replace", replace, v -> replace = v);
}
@Override
@@ -2013,7 +2017,7 @@ public class LStatements{
@Override
public LInstruction build(LAssembler builder){
return new MakeMarkerI(type, builder.var(id), builder.var(x), builder.var(y));
return new MakeMarkerI(type, builder.var(id), builder.var(x), builder.var(y), builder.var(replace));
}
@Override