LimboState

Inherits:

Inherited By: BTState, LimboHSM

A state node for Hierarchical State Machines (HSM).

Description

A LimboAI state node for Hierarchical State Machines (HSM).

You can create your state behavior by extending this class. To implement your state logic, you can override _enter, _exit, _setup, and _update. Alternatively, you can delegate state implementation to external methods using the call_on_* methods.

For additional details on state machines, refer to LimboHSM.

Properties

StringName

EVENT_FINISHED

Node

agent

Blackboard

blackboard

BlackboardPlan

blackboard_plan

Methods

void

_enter ( ) virtual

void

_exit ( ) virtual

void

_setup ( ) virtual

void

_update ( float delta ) virtual

void

add_event_handler ( StringName event, Callable handler )

LimboState

call_on_enter ( Callable callable )

LimboState

call_on_exit ( Callable callable )

LimboState

call_on_update ( Callable callable )

void

clear_guard ( )

bool

dispatch ( StringName event, Variant cargo=null )

LimboState

get_root ( ) const

bool

is_active ( ) const

LimboState

named ( String name )

void

set_guard ( Callable guard_callable )


Signals

entered ( )

Emitted when the state is entered.


exited ( )

Emitted when the state is exited.


setup ( )

Emitted when the state is initialized.


updated ( float delta )

Emitted when the state is updated.


Property Descriptions

StringName EVENT_FINISHED

  • StringName event_finished ( )

A commonly used event that indicates that the state has finished its work.


Node agent

  • void set_agent ( Node value )

  • Node get_agent ( )

An agent associated with the state, assigned during initialization.


Blackboard blackboard

A key/value data store shared by states within the state machine to which this state belongs.


BlackboardPlan blackboard_plan

Stores and manages variables that will be used in constructing new Blackboard instances.


Method Descriptions

void _enter ( ) virtual

Called when the state is entered.


void _exit ( ) virtual

Called when the state is exited.


void _setup ( ) virtual

Called once during initialization. Use this method to initialize your state.


void _update ( float delta ) virtual

Called during the update. Implement your state’s behavior with this method.


void add_event_handler ( StringName event, Callable handler )

Registers a handler to be called when event is dispatched.


LimboState call_on_enter ( Callable callable )

A chained method that connects the entered signal to a callable.


LimboState call_on_exit ( Callable callable )

A chained method that connects the exited signal to a callable.


LimboState call_on_update ( Callable callable )

A chained method that connects the updated signal to a callable.


void clear_guard ( )

Clears the guard function, removing the Callable previously set by set_guard.


bool dispatch ( StringName event, Variant cargo=null )

Recursively dispatches a state machine event named event with an optional argument cargo. Returns true if the event was consumed.

Events propagate from the leaf state to the root state, and propagation stops as soon as any state consumes the event. States will consume the event if they have a related transition or event handler. For more information on event handlers, see add_event_handler.


LimboState get_root ( ) const

Returns the root LimboState.


bool is_active ( ) const

Returns true if it is currently active, meaning it is the active substate of the parent LimboHSM.


LimboState named ( String name )

A chained method for setting the name of this state.


void set_guard ( Callable guard_callable )

Sets the guard function, which is a function called each time a transition to this state is considered. If the function returns false, the transition will be disallowed.