mirror of
https://github.com/Anuken/Mindustry.git
synced 2024-09-21 21:38:29 +03:00
Controlled sensor improvements
This commit is contained in:
parent
d8552915f7
commit
e6787c5146
@ -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.
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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()){
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user