Merge pull request #3163 from summetdev/logic-bounded

"Controlled" property for logic
This commit is contained in:
Anuken 2020-11-07 12:04:43 -05:00 committed by GitHub
commit d11a03e7d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View file

@ -29,6 +29,7 @@ import mindustry.logic.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
import mindustry.world.blocks.*;
import mindustry.world.blocks.ConstructBlock.*;
import mindustry.world.blocks.environment.*;
import mindustry.world.blocks.payloads.*;
@ -1285,6 +1286,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 payloadCount -> getPayload() != null ? 1 : 0;
default -> 0;
};

View file

@ -9,6 +9,7 @@ import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import mindustry.ai.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.core.*;
@ -105,6 +106,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
case shootX -> World.conv(aimX());
case shootY -> World.conv(aimY());
case flag -> flag;
case controlled -> controller instanceof LogicAI || controller instanceof Player ? 1 : 0;
case payloadCount -> self() instanceof Payloadc pay ? pay.payloads().size : 0;
default -> 0;
};

View file

@ -30,6 +30,7 @@ public enum LAccess{
team,
type,
flag,
controlled,
name,
config,
payloadCount,