Package mindustry.ai.types
Class CommandAI
java.lang.Object
mindustry.entities.units.AIController
mindustry.ai.types.CommandAI
- All Implemented Interfaces:
UnitController
-
Field Summary
Modifier and TypeFieldDescriptionmindustry.gen.Teamc
protected static final Vec2
Current command this unit is following.protected AIController
Current controller instance based on command.protected boolean
protected static final Vec2
protected UnitCommand
Last command type assigned.protected Vec2
protected Seq<mindustry.gen.Unit>
protected static final float
protected static final Vec2
protected static final boolean[]
protected int
protected static final Vec2
protected boolean
protected boolean
All encountered unreachable buildings of this AI.protected static final Vec2
Fields inherited from class mindustry.entities.units.AIController
fallback, noTargetTime, rotateBackTimer, target, timer, timerTarget, timerTarget2, timerTarget3, timerTarget4, unit, vec
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
command
(UnitCommand command) Attempts to assign a command to this unit.void
commandPosition
(Vec2 pos) void
commandPosition
(Vec2 pos, boolean stopWhenInRange) void
commandTarget
(mindustry.gen.Teamc moveTo) void
commandTarget
(mindustry.gen.Teamc moveTo, boolean stopAtTarget) void
mindustry.gen.Teamc
findTarget
(float x, float y, float range, boolean air, boolean ground) boolean
void
hit
(mindustry.gen.Bullet bullet) boolean
boolean
boolean
boolean
nearAttackTarget
(float x, float y, float range) boolean
retarget()
void
void
Methods inherited from class mindustry.entities.units.AIController
checkTarget, circle, circle, circleAttack, faceMovement, faceTarget, fallback, findMainTarget, getClosestSpawner, init, invalid, moveTo, moveTo, moveTo, moveTo, pathfind, shouldShoot, stopShooting, target, targetFlag, unit, unit, unloadPayloads, updateMovement, updateTargeting, updateVisuals, updateWeapons, useFallback
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface mindustry.entities.units.UnitController
isBeingControlled, isValidController, removed
-
Field Details
-
localInterval
protected static final float localInterval- See Also:
-
vecOut
-
flockVec
-
separation
-
cohesion
-
massCenter
-
noFound
protected static final boolean[] noFound -
targetPos
-
attackTarget
-
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
-
pathId
protected int pathId -
local
-
flocked
protected boolean flocked -
command
Current command this unit is following. -
commandController
Current controller instance based on command. -
lastCommand
Last command type assigned. Used for detecting command changes.
-
-
Constructor Details
-
CommandAI
public CommandAI()
-
-
Method Details
-
currentCommand
-
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 interfaceUnitController
- Overrides:
isLogicControllable
in classAIController
- Returns:
- whether logic AI can take over
-
isAttacking
public boolean isAttacking() -
updateUnit
public void updateUnit()- Specified by:
updateUnit
in interfaceUnitController
- Overrides:
updateUnit
in classAIController
-
defaultBehavior
public void defaultBehavior() -
hit
public void hit(mindustry.gen.Bullet bullet) -
keepState
public boolean keepState()- Overrides:
keepState
in classAIController
- 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 classAIController
-
nearAttackTarget
public boolean nearAttackTarget(float x, float y, float range) -
retarget
public boolean retarget()- Overrides:
retarget
in classAIController
-
hasCommand
public boolean hasCommand() -
setupLastPos
public void setupLastPos() -
commandPosition
- Overrides:
commandPosition
in classAIController
-
commandPosition
-
commandTarget
public void commandTarget(mindustry.gen.Teamc moveTo) - Overrides:
commandTarget
in classAIController
-
commandTarget
public void commandTarget(mindustry.gen.Teamc moveTo, boolean stopAtTarget)
-