diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index efc82172ca..ccfa3089ba 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -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; diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 2f36e87ffe..01f9e4b5f5 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -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); }); diff --git a/core/src/mindustry/logic/LAssembler.java b/core/src/mindustry/logic/LAssembler.java index 66b86befb7..75a7b77174 100644 --- a/core/src/mindustry/logic/LAssembler.java +++ b/core/src/mindustry/logic/LAssembler.java @@ -13,6 +13,11 @@ public class LAssembler{ public static ObjectMap> 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 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){ diff --git a/core/src/mindustry/logic/LStatement.java b/core/src/mindustry/logic/LStatement.java index ea54bd833b..bf8637ac63 100644 --- a/core/src/mindustry/logic/LStatement.java +++ b/core/src/mindustry/logic/LStatement.java @@ -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(); diff --git a/core/src/mindustry/logic/LStatements.java b/core/src/mindustry/logic/LStatements.java index 12447236e9..259bc8a10e 100644 --- a/core/src/mindustry/logic/LStatements.java +++ b/core/src/mindustry/logic/LStatements.java @@ -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 diff --git a/core/src/mindustry/logic/LogicOp.java b/core/src/mindustry/logic/LogicOp.java index faff215bd0..f7021cc03e 100644 --- a/core/src/mindustry/logic/LogicOp.java +++ b/core/src/mindustry/logic/LogicOp.java @@ -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