AIPlayer

Engine/source/T3D/aiPlayer.h

More...

Public Types

enum
MoveState {
  ModeStop 
  ModeMove 
  ModeStuck 
  ModeSlowing 
}

Private Types

Parent 

Private Functions

throwCallback(const char * name)

Utility function to throw callbacks.

Protected Functions

Called when we get within mMoveTolerance of our destination set using setMoveDestination().

Called when we move less than mMoveStuckTolerance in a tick, signalling that some obstacle is preventing us from getting where we need to go.

Public Functions

Constructor.

Destructor.

bool
checkInFoV(GameBase * target, F32 camFov, bool _checkEnabled)
bool
checkInLos(GameBase * target, bool _useMuzzle, bool _checkEnabled)

Clears the aim location and sets it to the bot's current destination so he looks where he's going.

Stop searching for cover.

Stop following me!

Clear the trigger state for all movement triggers.

Clear out the current path.

bool
getAIMove(Move * move)

This method calculates the moves for the AI player.

bool

Get the state of a movement trigger.

getMuzzleVector(U32 imageSlot, VectorF * vec)

Sets the correct aim for the bot to the target.

getTargetDistance(GameBase * target, bool _checkEnabled)
bool

Called when the object is added to the sim.

Called when the object is removed from the sim.

Sets the location for the bot to aim at.

setAimObject(GameBase * targetObject)

Sets the object the bot is targeting.

setAimObject(GameBase * targetObject, const Point3F & offset)

Sets the object the bot is targeting and an offset to add to target location.

setMoveDestination(const Point3F & location, bool slowdown)

Sets the location for the bot to run to.

Sets the speed at which this AI moves.

Sets how far away from the move location is considered "on target".

setMoveTrigger(U32 slot, const bool isSet)

Set the state of a movement trigger.

Stops movement for this AI.

Update the movement.

Public Static Functions

Detailed Description

Public Types

MoveState

Enumerator

ModeStop
ModeMove
ModeStuck
ModeSlowing

Private Types

typedef Player Parent 

Private Attributes

Point3F mAimLocation 
bool mAimLocationSet 
SimObjectPtr< GameBase > mAimObject 
Point3F mAimOffset 
F32 mAttackRadius 
Point3F mLastLocation 
Point3F mMoveDestination 
bool mMoveSlowdown 
F32 mMoveSpeed 
MoveState mMoveState 
S32 mMoveState_saved 
S32 mMoveStuckTestCountdown 
S32 mMoveStuckTestDelay 
F32 mMoveStuckTolerance 
F32 mMoveTolerance 
bool mMoveTriggers [MaxTriggerKeys]
bool mTargetInLOS 

Private Functions

throwCallback(const char * name)

Utility function to throw callbacks.

Callbacks always occure on the datablock class.

Parameters:

name

Name of script function to call

Protected Functions

onReachDestination()

Called when we get within mMoveTolerance of our destination set using setMoveDestination().

Only fires the script callback if we are at the end of a pathfinding path, or have no pathfinding path.

onStuck()

Called when we move less than mMoveStuckTolerance in a tick, signalling that some obstacle is preventing us from getting where we need to go.

Public Functions

AIPlayer()

Constructor.

~AIPlayer()

Destructor.

checkInFoV(GameBase * target, F32 camFov, bool _checkEnabled)

checkInLos(GameBase * target, bool _useMuzzle, bool _checkEnabled)

clearAim()

Clears the aim location and sets it to the bot's current destination so he looks where he's going.

clearCover()

Stop searching for cover.

clearFollow()

Stop following me!

clearMoveTriggers()

Clear the trigger state for all movement triggers.

clearPath()

Clear out the current path.

DECLARE_CONOBJECT(AIPlayer )

getAimLocation()

getAimObject()

getAIMove(Move * move)

Reimplemented from: Player

getAiPose()

getMoveDestination()

getMoveSpeed()

getMoveTolerance()

getMoveTrigger(U32 slot)

Get the state of a movement trigger.

Parameters:

slot

The trigger slot to query

return:

True if the trigger is set, false if it is not set

getMuzzleVector(U32 imageSlot, VectorF * vec)

Reimplemented from: Player

getTargetDistance(GameBase * target, bool _checkEnabled)

onAdd()

Reimplemented from: SceneObject

onRemove()

Reimplemented from: SceneObject

restartMove(U32 tag)

saveMoveState()

setAimLocation(const Point3F & location)

Sets the location for the bot to aim at.

Parameters:

location

Point to aim at

setAimObject(GameBase * targetObject)

Sets the object the bot is targeting.

Parameters:

targetObject

The object to target

setAimObject(GameBase * targetObject, const Point3F & offset)

Sets the object the bot is targeting and an offset to add to target location.

Parameters:

targetObject

The object to target

offset

The offest from the target location to aim at

setAiPose(S32 pose)

setMoveDestination(const Point3F & location, bool slowdown)

Sets the location for the bot to run to.

Parameters:

location

Point to run to

setMoveSpeed(const F32 speed)

Sets the speed at which this AI moves.

Parameters:

speed

Speed to move, default player was 10

setMoveTolerance(const F32 tolerance)

Sets how far away from the move location is considered "on target".

Parameters:

tolerance

Movement tolerance for error

setMoveTrigger(U32 slot, const bool isSet)

Set the state of a movement trigger.

Parameters:

slot

The trigger slot to set

isSet

set/unset the trigger

stopMove()

Stops movement for this AI.

updateMove(const Move * move)

Reimplemented from: Player

Public Static Functions

initPersistFields()