Package mindustry.entities.units
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,PrebuildAI,RepairAI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected mindustry.gen.Teamcprotected AIControllerprotected floatprotected static final floatprotected mindustry.gen.Teamcmain target that is being facedprotected arc.util.Intervalprotected static final intprotected static final intprotected static final intprotected static final intprotected mindustry.gen.Unitprotected static final arc.math.geom.Vec2 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterRead(mindustry.gen.Unit unit) arc.math.geom.Vec2alterPathfind(arc.math.geom.Vec2 vec) booleancheckTarget(mindustry.gen.Teamc target, float x, float y, float range) voidcircle(arc.math.geom.Position target, float circleLength) voidcircle(arc.math.geom.Position target, float circleLength, float speed) voidcircleAttack(float circleLength) voidcommandPosition(arc.math.geom.Vec2 pos) voidcommandTarget(mindustry.gen.Teamc moveTo) voidvoidFor ground units: Looks at the target, or the movement position.fallback()mindustry.gen.TeamcfindMainTarget(float x, float y, float range, boolean air, boolean ground) mindustry.gen.TeamcfindTarget(float x, float y, float range, boolean air, boolean ground) voidinit()Called after this controller is assigned a unit.booleaninvalid(mindustry.gen.Teamc target) booleanbooleanvoidmoveTo(arc.math.geom.Position target, float circleLength) voidmoveTo(arc.math.geom.Position target, float circleLength, float smooth) voidmoveTo(arc.math.geom.Position target, float circleLength, float smooth, boolean keepDistance, arc.math.geom.Vec2 offset) voidmoveTo(arc.math.geom.Position target, float circleLength, float smooth, boolean keepDistance, arc.math.geom.Vec2 offset, boolean arrive) voidpathfind(int pathTarget) voidpathfind(int pathTarget, boolean stopAtTargetTile) voidpathfind(int pathTarget, boolean stopAtTargetTile, boolean avoidance) floatprotected voidbooleanretarget()booleanbooleanvoidCalled when the parent CommandAI changes its stance.voidmindustry.gen.Teamctarget(float x, float y, float range, boolean air, boolean ground) mindustry.gen.TeamctargetFlag(float x, float y, BlockFlag flag, boolean enemy) voidmindustry.gen.Unitunit()voidunit(mindustry.gen.Unit unit) voidvoidvoidvoidvoidvoidbooleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mindustry.entities.units.UnitController
hit, isValidController, removed
-
Field Details
-
vec
protected static final arc.math.geom.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 arc.util.Interval timer -
fallback
-
noTargetTime
protected float noTargetTime -
target
@Nullable protected mindustry.gen.Teamc targetmain target that is being faced -
bomberTarget
@Nullable protected mindustry.gen.Teamc bomberTarget
-
-
Constructor Details
-
AIController
public AIController()
-
-
Method Details
-
resetTimers
protected void resetTimers() -
updateUnit
public void updateUnit()- Specified by:
updateUnitin interfaceUnitController
-
stanceChanged
public void stanceChanged()Called when the parent CommandAI changes its stance. -
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.
-
afterRead
public void afterRead(mindustry.gen.Unit unit) - Specified by:
afterReadin interfaceUnitController
-
isLogicControllable
public boolean isLogicControllable()- Specified by:
isLogicControllablein interfaceUnitController- Returns:
- whether logic AI can take over
-
stopShooting
public void stopShooting() -
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) -
pathfind
public void pathfind(int pathTarget, boolean stopAtTargetTile) -
pathfind
public void pathfind(int pathTarget, boolean stopAtTargetTile, boolean avoidance) -
alterPathfind
public arc.math.geom.Vec2 alterPathfind(arc.math.geom.Vec2 vec) -
targetInvalidated
public void targetInvalidated() -
updateWeapons
public void updateWeapons() -
checkTarget
public boolean checkTarget(mindustry.gen.Teamc target, float x, float y, float range) -
shouldFire
public boolean shouldFire()- Returns:
- whether the unit should actually fire bullets (as opposed to just targeting something)
-
shouldShoot
public boolean shouldShoot() -
targetFlag
-
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(arc.math.geom.Vec2 pos) -
init
public void init()Called after this controller is assigned a unit. -
getClosestSpawner
-
unloadPayloads
public void unloadPayloads() -
circleAttack
public void circleAttack(float circleLength) -
circle
public void circle(arc.math.geom.Position target, float circleLength) -
circle
public void circle(arc.math.geom.Position target, float circleLength, float speed) -
moveTo
public void moveTo(arc.math.geom.Position target, float circleLength) -
moveTo
public void moveTo(arc.math.geom.Position target, float circleLength, float smooth) -
moveTo
public void moveTo(arc.math.geom.Position target, float circleLength, float smooth, boolean keepDistance, @Nullable arc.math.geom.Vec2 offset) -
moveTo
public void moveTo(arc.math.geom.Position target, float circleLength, float smooth, boolean keepDistance, @Nullable arc.math.geom.Vec2 offset, boolean arrive) -
prefSpeed
public float prefSpeed() -
unit
public void unit(mindustry.gen.Unit unit) - Specified by:
unitin interfaceUnitController
-
unit
public mindustry.gen.Unit unit()- Specified by:
unitin interfaceUnitController
-