mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-22 05:47:44 +03:00
Fixed #4642 / Logic op reorganization
This commit is contained in:
parent
38843c25fb
commit
a99151441c
@ -41,9 +41,10 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
boolean admin;
|
||||
@SyncLocal float mouseX, mouseY;
|
||||
String name = "noname";
|
||||
String locale = "en";
|
||||
Color color = new Color();
|
||||
|
||||
//locale should not be synced.
|
||||
transient String locale = "en";
|
||||
transient float deathTimer;
|
||||
transient String lastText = "";
|
||||
transient float textFadeTime;
|
||||
|
@ -62,19 +62,18 @@ public class DesktopInput extends InputHandler{
|
||||
group.fill(t -> {
|
||||
t.bottom();
|
||||
t.visible(() -> {
|
||||
t.color.a = Mathf.lerpDelta(t.color.a, !isBuilding && !Core.settings.getBool("buildautopause") || player.unit().isBuilding() ? 1f : 0f, 0.15f);
|
||||
t.color.a = Mathf.lerpDelta(t.color.a, player.unit().isBuilding() ? 1f : 0f, 0.15f);
|
||||
|
||||
return ui.hudfrag.shown && Core.settings.getBool("hints") && selectRequests.isEmpty() && t.color.a > 0.01f;
|
||||
});
|
||||
t.touchable(() -> t.color.a < 0.1f ? Touchable.disabled : Touchable.childrenOnly);
|
||||
t.table(Styles.black6, b -> {
|
||||
b.defaults().left();
|
||||
b.label(() -> ((!isBuilding || !wasBuilding) && !Core.settings.getBool("buildautopause") && !player.unit().isBuilding() ?
|
||||
Core.bundle.format("enablebuilding", Core.keybinds.get(Binding.pause_building).key.toString()) :
|
||||
Core.bundle.format(isBuilding ? "pausebuilding" : "resumebuilding", Core.keybinds.get(Binding.pause_building).key.toString()) +
|
||||
"\n" + Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString()) +
|
||||
"\n" + Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString())
|
||||
)).style(Styles.outlineLabel);
|
||||
b.label(() -> Core.bundle.format(!isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.toString())).style(Styles.outlineLabel);
|
||||
b.row();
|
||||
b.label(() -> Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString())).style(Styles.outlineLabel);
|
||||
b.row();
|
||||
b.label(() -> Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString())).style(Styles.outlineLabel);
|
||||
}).margin(10f);
|
||||
});
|
||||
|
||||
|
@ -13,6 +13,11 @@ public class LAssembler{
|
||||
public static ObjectMap<String, Func<String[], LStatement>> customParsers = new ObjectMap<>();
|
||||
public static final int maxTokenLength = 36;
|
||||
|
||||
private static final StringMap opNameChanges = StringMap.of(
|
||||
"atan2", "angle",
|
||||
"dst", "len"
|
||||
);
|
||||
|
||||
private int lastVar;
|
||||
/** Maps names to variable IDs. */
|
||||
public ObjectMap<String, BVar> vars = new ObjectMap<>();
|
||||
@ -127,6 +132,11 @@ public class LAssembler{
|
||||
}
|
||||
}
|
||||
|
||||
//fix up changed operaiton names
|
||||
if(type.equals("op")){
|
||||
arr[1] = opNameChanges.get(arr[1], arr[1]);
|
||||
}
|
||||
|
||||
LStatement st = LogicIO.read(arr);
|
||||
|
||||
if(st != null){
|
||||
|
@ -114,7 +114,6 @@ public abstract class LStatement{
|
||||
t.actions(Actions.alpha(0), Actions.fadeIn(0.3f, Interp.fade));
|
||||
|
||||
t.top().pane(inner -> {
|
||||
inner.marginRight(24f);
|
||||
inner.top();
|
||||
hideCons.get(inner, hide);
|
||||
}).top();
|
||||
|
@ -608,11 +608,20 @@ public class LStatements{
|
||||
}else{
|
||||
row(table);
|
||||
|
||||
field(table, a, str -> a = str);
|
||||
//"function"-type operations have the name at the left and arguments on the right
|
||||
if(op.func){
|
||||
opButton(table);
|
||||
|
||||
opButton(table);
|
||||
field(table, a, str -> a = str);
|
||||
|
||||
field(table, b, str -> b = str);
|
||||
field(table, b, str -> b = str);
|
||||
}else{
|
||||
field(table, a, str -> a = str);
|
||||
|
||||
opButton(table);
|
||||
|
||||
field(table, b, str -> b = str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -623,7 +632,7 @@ public class LStatements{
|
||||
op = o;
|
||||
rebuild(table);
|
||||
}));
|
||||
}, Styles.logict, () -> {}).size(60f, 40f).pad(4f).color(table.color);
|
||||
}, Styles.logict, () -> {}).size(65f, 40f).pad(4f).color(table.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,11 +28,11 @@ public enum LogicOp{
|
||||
xor("xor", (a, b) -> (long)a ^ (long)b),
|
||||
not("flip", a -> ~(long)(a)),
|
||||
|
||||
max("max", Math::max),
|
||||
min("min", Math::min),
|
||||
atan2("atan2", (x, y) -> Mathf.atan2((float)x, (float)y) * Mathf.radDeg),
|
||||
dst("dst", (x, y) -> Mathf.dst((float)x, (float)y)),
|
||||
noise("noise", LExecutor.noise::rawNoise2D),
|
||||
max("max", true, Math::max),
|
||||
min("min", true, Math::min),
|
||||
angle("angle", true, (x, y) -> Angles.angle((float)x, (float)y)),
|
||||
len("len", true, (x, y) -> Mathf.dst((float)x, (float)y)),
|
||||
noise("noise", true, LExecutor.noise::rawNoise2D),
|
||||
abs("abs", a -> Math.abs(a)),
|
||||
log("log", Math::log),
|
||||
log10("log10", Math::log10),
|
||||
@ -49,19 +49,29 @@ public enum LogicOp{
|
||||
public final OpObjLambda2 objFunction2;
|
||||
public final OpLambda2 function2;
|
||||
public final OpLambda1 function1;
|
||||
public final boolean unary;
|
||||
public final boolean unary, func;
|
||||
public final String symbol;
|
||||
|
||||
LogicOp(String symbol, OpLambda2 function){
|
||||
this(symbol, function, null);
|
||||
}
|
||||
|
||||
LogicOp(String symbol, boolean func, OpLambda2 function){
|
||||
this.symbol = symbol;
|
||||
this.function2 = function;
|
||||
this.function1 = null;
|
||||
this.unary = false;
|
||||
this.objFunction2 = null;
|
||||
this.func = func;
|
||||
}
|
||||
|
||||
LogicOp(String symbol, OpLambda2 function, OpObjLambda2 objFunction){
|
||||
this.symbol = symbol;
|
||||
this.function2 = function;
|
||||
this.function1 = null;
|
||||
this.unary = false;
|
||||
this.objFunction2 = objFunction;
|
||||
this.func = false;
|
||||
}
|
||||
|
||||
LogicOp(String symbol, OpLambda1 function){
|
||||
@ -70,6 +80,7 @@ public enum LogicOp{
|
||||
this.function2 = null;
|
||||
this.unary = true;
|
||||
this.objFunction2 = null;
|
||||
this.func = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user