Controlled sensor improvements

This commit is contained in:
Anuken
2021-02-21 12:28:00 -05:00
parent d8552915f7
commit e6787c5146
5 changed files with 11 additions and 3 deletions

View File

@@ -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
};

View File

@@ -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;

View File

@@ -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()){

View File

@@ -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