2022-11-01 20:31:22 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-11-15 14:40:07 +00:00
<class name= "LimboState" inherits= "Node" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2022-11-01 20:31:22 +00:00
<brief_description >
2023-10-26 13:45:24 +00:00
A state node for Hierarchical State Machines (HSM).
2022-11-01 20:31:22 +00:00
</brief_description>
<description >
2023-10-26 13:45:24 +00:00
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 [method _enter], [method _exit], [method _setup], and [method _update]. Alternatively, you can delegate state implementation to external methods using the [code]call_on_*[/code] methods.
For additional details on state machines, refer to [LimboHSM].
2022-11-01 20:31:22 +00:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "_enter" qualifiers= "virtual" >
<return type= "void" />
<description >
2023-10-26 13:45:24 +00:00
Called when the state is entered.
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "_exit" qualifiers= "virtual" >
<return type= "void" />
<description >
2023-10-26 13:45:24 +00:00
Called when the state is exited.
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "_setup" qualifiers= "virtual" >
<return type= "void" />
<description >
2023-10-26 13:45:24 +00:00
Called once during initialization. Use this method to initialize your state.
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "_update" qualifiers= "virtual" >
<return type= "void" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_delta" type= "float" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
Called during the update. Implement your state's behavior with this method.
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "add_event_handler" >
<return type= "void" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_event" type= "String" />
<param index= "1" name= "p_handler" type= "Callable" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
Registers a [code]p_method[/code] to be called when [code]p_event[/code] is dispatched. The method must belong to the state.
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "call_on_enter" >
<return type= "LimboState" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_callable" type= "Callable" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
A chained method that connects the [signal entered] signal to a [code]p_callable[/code].
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "call_on_exit" >
<return type= "LimboState" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_callable" type= "Callable" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
A chained method that connects the [signal exited] signal to a [code]p_callable[/code].
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "call_on_update" >
<return type= "LimboState" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_callable" type= "Callable" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
A chained method that connects the [signal updated] signal to a [code]p_callable[/code].
2022-11-01 20:31:22 +00:00
</description>
</method>
2023-04-10 14:57:36 +00:00
<method name= "clear_guard" >
2022-11-01 20:31:22 +00:00
<return type= "void" />
<description >
2023-10-26 13:45:24 +00:00
Clears the guard function, removing the [Callable] previously set by [method set_guard].
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "dispatch" >
<return type= "bool" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_event" type= "String" />
<param index= "1" name= "p_cargo" type= "Variant" default= "null" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
Recursively dispatches a state machine event named [code]p_event[/code] with an optional argument [code]p_cargo[/code]. Returns [code]true[/code] 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 [method add_event_handler].
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "get_root" qualifiers= "const" >
<return type= "LimboState" />
<description >
2022-11-04 12:27:09 +00:00
Returns the root [LimboState].
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "is_active" qualifiers= "const" >
<return type= "bool" />
<description >
2023-10-26 13:45:24 +00:00
Returns [code]true[/code] if it is currently active, meaning it is the active substate of the parent [LimboHSM].
2022-11-01 20:31:22 +00:00
</description>
</method>
<method name= "named" >
<return type= "LimboState" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_name" type= "String" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
A chained method for setting the name of this state.
2022-11-01 20:31:22 +00:00
</description>
</method>
2023-04-10 14:57:36 +00:00
<method name= "set_guard" >
2022-11-01 20:31:22 +00:00
<return type= "void" />
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_guard_callable" type= "Callable" />
2022-11-01 20:31:22 +00:00
<description >
2023-10-26 13:45:24 +00:00
Sets the guard function, which is a function called each time a transition to this state is considered. If the function returns [code]false[/code], the transition will be disallowed.
2022-11-01 20:31:22 +00:00
</description>
</method>
</methods>
<members >
<member name= "EVENT_FINISHED" type= "String" setter= "" getter= "event_finished" >
2023-10-26 13:45:24 +00:00
A commonly used event that indicates that the state has finished its work.
2022-11-01 20:31:22 +00:00
</member>
2023-04-10 14:57:36 +00:00
<member name= "agent" type= "Node" setter= "set_agent" getter= "get_agent" >
2023-10-26 13:45:24 +00:00
An agent associated with the state, assigned during initialization.
2022-11-01 20:31:22 +00:00
</member>
<member name= "blackboard" type= "Blackboard" setter= "" getter= "get_blackboard" >
2023-10-26 13:45:24 +00:00
A key/value data store shared by states within the state machine to which this state belongs.
2022-11-01 20:31:22 +00:00
</member>
</members>
<signals >
<signal name= "entered" >
<description >
2022-11-04 12:27:09 +00:00
Emitted when the state is entered.
2022-11-01 20:31:22 +00:00
</description>
</signal>
<signal name= "exited" >
<description >
2022-11-04 12:27:09 +00:00
Emitted when the state is exited.
2022-11-01 20:31:22 +00:00
</description>
</signal>
<signal name= "setup" >
<description >
2022-11-04 12:27:09 +00:00
Emitted when the state is initialized.
2022-11-01 20:31:22 +00:00
</description>
</signal>
<signal name= "updated" >
2023-04-10 14:57:36 +00:00
<param index= "0" name= "p_delta" type= "float" />
2022-11-01 20:31:22 +00:00
<description >
2022-11-04 12:27:09 +00:00
Emitted when the state is updated.
2022-11-01 20:31:22 +00:00
</description>
</signal>
</signals>
</class>