Texture marker implementation

This commit is contained in:
ApsZoldat
2023-11-07 22:42:42 +03:00
parent cdb6e3f85b
commit 6dff68e7d9
5 changed files with 89 additions and 5 deletions

View File

@@ -1555,7 +1555,7 @@ public class LExecutor{
@Override
public void run(LExecutor exec){
//set default to succes
//set default to success
exec.setnum(outSuccess, 1);
if(headless && type != MessageType.mission) {
exec.textBuffer.setLength(0);
@@ -1879,6 +1879,13 @@ public class LExecutor{
}else if(type == LMarkerControl.flushText){
marker.setText(exec.textBuffer.toString(), true);
exec.textBuffer.setLength(0);
}else if(type == LMarkerControl.texture){
if(exec.obj(p1) != null){
StringBuilder res = new StringBuilder(exec.obj(p1).toString());
if(exec.obj(p2) != null) res.append("-").append(exec.obj(p2).toString());
if(exec.obj(p3) != null) res.append("-").append(exec.obj(p3).toString());
marker.setTexture(res.toString());
}
}else{
marker.control(type, exec.num(p1), exec.num(p2), exec.num(p3));
}
@@ -1944,5 +1951,13 @@ public class LExecutor{
}
}
@Remote(called = Loc.server, variants = Variant.both, unreliable = true)
public static void updateMarkerTexture(int id, String textureName){
var marker = state.markers.get(id);
if(marker != null){
marker.setTexture(textureName);
}
}
//endregion
}

View File

@@ -24,7 +24,10 @@ public enum LMarkerControl{
shapeFill("true/false"),
shapeOutline("true/false"),
setShape("sides", "fill", "outline"),
color("color");
color("color"),
texture("name", "-", "-"),
textureWidth("width"),
textureHeight("height");
public final String[] params;

View File

@@ -1943,7 +1943,7 @@ public class LStatements{
b.clicked(() -> showSelect(b, LMarkerControl.all, type, t -> {
type = t;
rebuild(table);
}, 2, cell -> cell.size(140, 50)));
}, 3, cell -> cell.size(140, 50)));
}, Styles.logict, () -> {}).size(190, 40).color(table.color).left().padLeft(2);
row(table);