Class AIController

java.lang.Object
mindustry.entities.units.AIController
All Implemented Interfaces:
UnitController
Direct Known Subclasses:
AssemblerAI, BoostAI, BuilderAI, CargoAI, CommandAI, DefenderAI, DroneCenter.EffectDroneAI, FlyingAI, GroundAI, HugAI, LogicAI, MinerAI, MissileAI, RepairAI

public class AIController extends Object implements UnitController
  • Field Details

    • vec

      protected static final Vec2 vec
    • rotateBackTimer

      protected static final float rotateBackTimer
      See Also:
    • timerTarget

      protected static final int timerTarget
      See Also:
    • timerTarget2

      protected static final int timerTarget2
      See Also:
    • timerTarget3

      protected static final int timerTarget3
      See Also:
    • timerTarget4

      protected static final int timerTarget4
      See Also:
    • unit

      protected mindustry.gen.Unit unit
    • timer

      protected Interval timer
    • fallback

      protected AIController fallback
    • noTargetTime

      protected float noTargetTime
    • target

      protected mindustry.gen.Teamc target
      main target that is being faced
  • Constructor Details

    • AIController

      public AIController()
  • Method Details

    • updateUnit

      public void updateUnit()
      Specified by:
      updateUnit in interface UnitController
    • keepState

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

      public boolean isLogicControllable()
      Specified by:
      isLogicControllable in interface UnitController
      Returns:
      whether logic AI can take over
    • stopShooting

      public void stopShooting()
    • fallback

      @Nullable public AIController fallback()
    • useFallback

      public boolean useFallback()
    • updateVisuals

      public void updateVisuals()
    • updateMovement

      public void updateMovement()
    • updateTargeting

      public void updateTargeting()
    • faceTarget

      public void faceTarget()
      For ground units: Looks at the target, or the movement position. Does not apply to non-omni units.
    • faceMovement

      public void faceMovement()
    • invalid

      public boolean invalid(mindustry.gen.Teamc target)
    • pathfind

      public void pathfind(int pathTarget)
    • updateWeapons

      public void updateWeapons()
    • checkTarget

      public boolean checkTarget(mindustry.gen.Teamc target, float x, float y, float range)
    • shouldShoot

      public boolean shouldShoot()
    • targetFlag

      public mindustry.gen.Teamc targetFlag(float x, float y, BlockFlag flag, boolean enemy)
    • target

      public mindustry.gen.Teamc target(float x, float y, float range, boolean air, boolean ground)
    • retarget

      public boolean retarget()
    • findMainTarget

      public mindustry.gen.Teamc findMainTarget(float x, float y, float range, boolean air, boolean ground)
    • findTarget

      public mindustry.gen.Teamc findTarget(float x, float y, float range, boolean air, boolean ground)
    • commandTarget

      public void commandTarget(mindustry.gen.Teamc moveTo)
    • commandPosition

      public void commandPosition(Vec2 pos)
    • init

      public void init()
      Called after this controller is assigned a unit.
    • getClosestSpawner

      @Nullable public Tile getClosestSpawner()
    • unloadPayloads

      public void unloadPayloads()
    • circleAttack

      public void circleAttack(float circleLength)
    • circle

      public void circle(Position target, float circleLength)
    • circle

      public void circle(Position target, float circleLength, float speed)
    • moveTo

      public void moveTo(Position target, float circleLength)
    • moveTo

      public void moveTo(Position target, float circleLength, float smooth)
    • moveTo

      public void moveTo(Position target, float circleLength, float smooth, boolean keepDistance, @Nullable Vec2 offset)
    • moveTo

      public void moveTo(Position target, float circleLength, float smooth, boolean keepDistance, @Nullable Vec2 offset, boolean arrive)
    • unit

      public void unit(mindustry.gen.Unit unit)
      Specified by:
      unit in interface UnitController
    • unit

      public mindustry.gen.Unit unit()
      Specified by:
      unit in interface UnitController