Class CommandAI

All Implemented Interfaces:
UnitController

public class CommandAI extends AIController
  • Field Details

    • localInterval

      protected static final float localInterval
      See Also:
    • vecOut

      protected static final Vec2 vecOut
    • flockVec

      protected static final Vec2 flockVec
    • separation

      protected static final Vec2 separation
    • cohesion

      protected static final Vec2 cohesion
    • massCenter

      protected static final Vec2 massCenter
    • noFound

      protected static final boolean[] noFound
    • targetPos

      @Nullable public Vec2 targetPos
    • attackTarget

      @Nullable public mindustry.gen.Teamc attackTarget
    • unreachableBuildings

      public IntSeq unreachableBuildings
      All encountered unreachable buildings of this AI. Why a sequence? Because contains() is very rarely called on it.
    • stopAtTarget

      protected boolean stopAtTarget
    • stopWhenInRange

      protected boolean stopWhenInRange
    • lastTargetPos

      protected Vec2 lastTargetPos
    • pathId

      protected int pathId
    • local

      protected Seq<mindustry.gen.Unit> local
    • flocked

      protected boolean flocked
    • command

      @Nullable public UnitCommand command
      Current command this unit is following.
    • commandController

      @Nullable protected AIController commandController
      Current controller instance based on command.
    • lastCommand

      @Nullable protected UnitCommand lastCommand
      Last command type assigned. Used for detecting command changes.
  • Constructor Details

    • CommandAI

      public CommandAI()
  • Method Details

    • currentCommand

      public UnitCommand currentCommand()
    • command

      public void command(UnitCommand command)
      Attempts to assign a command to this unit. If not supported by the unit type, does nothing.
    • isLogicControllable

      public boolean isLogicControllable()
      Specified by:
      isLogicControllable in interface UnitController
      Overrides:
      isLogicControllable in class AIController
      Returns:
      whether logic AI can take over
    • isAttacking

      public boolean isAttacking()
    • updateUnit

      public void updateUnit()
      Specified by:
      updateUnit in interface UnitController
      Overrides:
      updateUnit in class AIController
    • defaultBehavior

      public void defaultBehavior()
    • hit

      public void hit(mindustry.gen.Bullet bullet)
    • keepState

      public boolean keepState()
      Overrides:
      keepState in class AIController
      Returns:
      whether controller state should not be reset after reading. Do not override unless you know exactly what you are doing.
    • findTarget

      public mindustry.gen.Teamc findTarget(float x, float y, float range, boolean air, boolean ground)
      Overrides:
      findTarget in class AIController
    • nearAttackTarget

      public boolean nearAttackTarget(float x, float y, float range)
    • retarget

      public boolean retarget()
      Overrides:
      retarget in class AIController
    • hasCommand

      public boolean hasCommand()
    • setupLastPos

      public void setupLastPos()
    • commandPosition

      public void commandPosition(Vec2 pos)
      Overrides:
      commandPosition in class AIController
    • commandPosition

      public void commandPosition(Vec2 pos, boolean stopWhenInRange)
    • commandTarget

      public void commandTarget(mindustry.gen.Teamc moveTo)
      Overrides:
      commandTarget in class AIController
    • commandTarget

      public void commandTarget(mindustry.gen.Teamc moveTo, boolean stopAtTarget)