diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 2727246299..30c58e23b1 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1548,6 +1548,8 @@ lenum.enabled = Whether the block is enabled. laccess.color = Illuminator color. laccess.controller = Unit controller. If processor controlled, returns processor.\nIf in a formation, returns leader.\nOtherwise, returns the unit itself. laccess.dead = Whether a unit/building is dead or no longer valid. +laccess.controlled = Returns:\n[accent]@contProcessor[] if unit controller is processor\n[accent]@contPlayer[] if unit/building controller is player\n[accent]@contFormation[] if unit is in formation\nOtherwise, 0. +laccess.commanded = [red]Deprecated. Will be removed![]\nUse [accent]controlled[] instead. graphicstype.clear = Fill the display with a color. graphicstype.color = Set color for next drawing operations. diff --git a/core/src/mindustry/entities/comp/BuildingComp.java b/core/src/mindustry/entities/comp/BuildingComp.java index 7a438d19ff..9cc2573147 100644 --- a/core/src/mindustry/entities/comp/BuildingComp.java +++ b/core/src/mindustry/entities/comp/BuildingComp.java @@ -1337,7 +1337,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc, case powerNetStored -> power == null ? 0 : power.graph.getLastPowerStored(); case powerNetCapacity -> power == null ? 0 : power.graph.getLastCapacity(); case enabled -> enabled ? 1 : 0; - case controlled -> this instanceof ControlBlock c ? c.isControlled() ? 1 : 0 : 0; + case controlled -> this instanceof ControlBlock c && c.isControlled() ? 2 : 0; case payloadCount -> getPayload() != null ? 1 : 0; default -> Float.NaN; //gets converted to null in logic }; diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 93b3342878..de80519ba6 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -139,7 +139,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I case mineX -> mining() ? mineTile.x : -1; case mineY -> mining() ? mineTile.y : -1; case flag -> flag; - case controlled -> controller instanceof LogicAI || controller instanceof Player ? 1 : 0; + case controlled -> controller instanceof LogicAI ? 1 : controller instanceof Player ? 2 : controller instanceof FormationAI ? 3 : 0; case commanded -> controller instanceof FormationAI ? 1 : 0; case payloadCount -> self() instanceof Payloadc pay ? pay.payloads().size : 0; default -> Float.NaN; diff --git a/core/src/mindustry/logic/GlobalConstants.java b/core/src/mindustry/logic/GlobalConstants.java index eea74416c0..9781b66c52 100644 --- a/core/src/mindustry/logic/GlobalConstants.java +++ b/core/src/mindustry/logic/GlobalConstants.java @@ -19,6 +19,12 @@ public class GlobalConstants{ put("true", 1); put("null", null); + //special enums + + put("@contProcessor", 1); + put("@contPlayer", 2); + put("@contFormation", 3); + //store base content for(Item item : Vars.content.items()){ diff --git a/core/src/mindustry/logic/LAccess.java b/core/src/mindustry/logic/LAccess.java index e2a49e1f87..e3403a56be 100644 --- a/core/src/mindustry/logic/LAccess.java +++ b/core/src/mindustry/logic/LAccess.java @@ -38,12 +38,12 @@ public enum LAccess{ type, flag, controlled, + controller, commanded, name, config, payloadCount, payloadType, - controller, //values with parameters are considered controllable enabled("to"), //"to" is standard for single parameter access