AiState
A userdata object representing an AI state belonging to a Unit.
This library can only be used on the server.
Operations:Operation | Description |
---|---|
AiState == AiState | Checks if two instances of AiState refer to the same AiState . |
Functions
getFacingDirection
AiState:getFacingDirection()
Server-Only
Returns the state's facing direction.
Arguments:AiState
[ AiState ]: The state.
- [ Vec3 ]: The direction.
getMovementDirection
AiState:getMovementDirection()
Server-Only
Returns the state's movement direction.
Arguments:AiState
[ AiState ]: The state.
- [ Vec3 ]: The direction.
getMovementType
AiState:getMovementType()
Server-Only
Returns a string describing the state's movement type.
Movement type can be "stand", "walk", "sprint" or "crouch".
Arguments:AiState
[ AiState ]: The state.
- [ string ]: The movement type.
getWantsJump
AiState:getWantsJump()
Server-Only
Check if the state wants to jump.
Arguments:AiState
[ AiState ]: The state.
- [ bool ]: True when the state wants to jump.
isDone
AiState:isDone()
Server-Only
Checks if the AI state is done.
Returns true when the state is done, and a string describing the state's current situation.
Can be used to determine if another state is allowed to be started.
Arguments:AiState
[ AiState ]: The state.
- [ bool ]: True if the state is done.
- [ string ]: The state's current situation.
onFixedUpdate
AiState:onFixedUpdate( dt )
Server-Only
Updates the state by adding delta time progression.
Should be called once every game tick while the state is active.
Arguments:AiState
[ AiState ]: The state.dt
[ number ]: The delta time.
onUnitUpdate
AiState:onUnitUpdate( dt )
Server-Only
Updates the state by adding delta time progression.
Should be called once every unit update, by the unit that owns the state, while the state is active.
Arguments:AiState
[ AiState ]: The state.dt
[ number ]: The delta time.
start
AiState:start()
Server-Only
Starts the state.
Arguments:AiState
[ AiState ]: The state.
stop
AiState:stop()
Server-Only
Stops the state.
Arguments:AiState
[ AiState ]: The state.