2024-01-12 20:05:50 +00:00
:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.2/modules/limboai/doc_classes/LimboState.xml.
.. _class_LimboState:
LimboState
==========
**Inherits:**
**Inherited By:** :ref: `BTState<class_BTState>` , :ref: `LimboHSM<class_LimboHSM>`
A state node for Hierarchical State Machines (HSM).
.. rst-class :: classref-introduction-group
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 :ref: `_enter<class_LimboState_private_method__enter>` , :ref: `_exit<class_LimboState_private_method__exit>` , :ref: `_setup<class_LimboState_private_method__setup>` , and :ref: `_update<class_LimboState_private_method__update>` . Alternatively, you can delegate state implementation to external methods using the `` call_on_* `` methods.
For additional details on state machines, refer to :ref: `LimboHSM<class_LimboHSM>` .
.. rst-class :: classref-reftable-group
Properties
----------
.. table ::
:widths: auto
2024-01-25 13:56:59 +00:00
+---------------------------------------------+-------------------------------------------------------------------+
2024-03-04 15:14:47 +00:00
| StringName | :ref: `EVENT_FINISHED<class_LimboState_property_EVENT_FINISHED>` |
2024-01-25 13:56:59 +00:00
+---------------------------------------------+-------------------------------------------------------------------+
| Node | :ref: `agent<class_LimboState_property_agent>` |
+---------------------------------------------+-------------------------------------------------------------------+
| :ref: `Blackboard<class_Blackboard>` | :ref: `blackboard<class_LimboState_property_blackboard>` |
+---------------------------------------------+-------------------------------------------------------------------+
| :ref: `BlackboardPlan<class_BlackboardPlan>` | :ref: `blackboard_plan<class_LimboState_property_blackboard_plan>` |
+---------------------------------------------+-------------------------------------------------------------------+
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-reftable-group
Methods
-------
.. table ::
:widths: auto
2024-03-04 20:36:16 +00:00
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `_enter<class_LimboState_private_method__enter>` **(** **)** |virtual| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `_exit<class_LimboState_private_method__exit>` **(** **)** |virtual| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `_setup<class_LimboState_private_method__setup>` **(** **)** |virtual| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `_update<class_LimboState_private_method__update>` **(** float delta **)** |virtual| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `add_event_handler<class_LimboState_method_add_event_handler>` **(** StringName event, Callable handler **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| :ref: `LimboState<class_LimboState>` | :ref: `call_on_enter<class_LimboState_method_call_on_enter>` **(** Callable callable **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| :ref: `LimboState<class_LimboState>` | :ref: `call_on_exit<class_LimboState_method_call_on_exit>` **(** Callable callable **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| :ref: `LimboState<class_LimboState>` | :ref: `call_on_update<class_LimboState_method_call_on_update>` **(** Callable callable **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `clear_guard<class_LimboState_method_clear_guard>` **(** **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| bool | :ref: `dispatch<class_LimboState_method_dispatch>` **(** StringName event, Variant cargo=null **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| :ref: `LimboState<class_LimboState>` | :ref: `get_root<class_LimboState_method_get_root>` **(** **)** |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| bool | :ref: `is_active<class_LimboState_method_is_active>` **(** **)** |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| :ref: `LimboState<class_LimboState>` | :ref: `named<class_LimboState_method_named>` **(** String name **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| void | :ref: `set_guard<class_LimboState_method_set_guard>` **(** Callable guard_callable **)** |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Signals
-------
.. _class_LimboState_signal_entered:
.. rst-class :: classref-signal
**entered** **(** **)**
Emitted when the state is entered.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_signal_exited:
.. rst-class :: classref-signal
**exited** **(** **)**
Emitted when the state is exited.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_signal_setup:
.. rst-class :: classref-signal
**setup** **(** **)**
Emitted when the state is initialized.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_signal_updated:
.. rst-class :: classref-signal
2024-03-04 20:36:16 +00:00
**updated** **(** float delta **)**
2024-01-12 20:05:50 +00:00
Emitted when the state is updated.
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Property Descriptions
---------------------
.. _class_LimboState_property_EVENT_FINISHED:
.. rst-class :: classref-property
2024-03-04 15:14:47 +00:00
StringName **EVENT_FINISHED**
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-property-setget
2024-03-04 15:14:47 +00:00
- StringName **event_finished** **(** **)**
2024-01-12 20:05:50 +00:00
A commonly used event that indicates that the state has finished its work.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_property_agent:
.. rst-class :: classref-property
Node **agent**
.. rst-class :: classref-property-setget
- void **set_agent** **(** Node value **)**
- Node **get_agent** **(** **)**
An agent associated with the state, assigned during initialization.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_property_blackboard:
.. rst-class :: classref-property
:ref: `Blackboard<class_Blackboard>` **blackboard**
.. rst-class :: classref-property-setget
- :ref: `Blackboard<class_Blackboard>` **get_blackboard** **(** **)**
A key/value data store shared by states within the state machine to which this state belongs.
2024-01-25 13:56:59 +00:00
.. rst-class :: classref-item-separator
----
.. _class_LimboState_property_blackboard_plan:
.. rst-class :: classref-property
:ref: `BlackboardPlan<class_BlackboardPlan>` **blackboard_plan**
.. rst-class :: classref-property-setget
- void **set_blackboard_plan** **(** :ref: `BlackboardPlan<class_BlackboardPlan>` value **)**
- :ref: `BlackboardPlan<class_BlackboardPlan>` **get_blackboard_plan** **(** **)**
Stores and manages variables that will be used in constructing new :ref: `Blackboard<class_Blackboard>` instances.
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-section-separator
----
.. rst-class :: classref-descriptions-group
Method Descriptions
-------------------
.. _class_LimboState_private_method__enter:
.. rst-class :: classref-method
void **_enter** **(** **)** |virtual|
Called when the state is entered.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_private_method__exit:
.. rst-class :: classref-method
void **_exit** **(** **)** |virtual|
Called when the state is exited.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_private_method__setup:
.. rst-class :: classref-method
void **_setup** **(** **)** |virtual|
Called once during initialization. Use this method to initialize your state.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_private_method__update:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
void **_update** **(** float delta **)** |virtual|
2024-01-12 20:05:50 +00:00
Called during the update. Implement your state's behavior with this method.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_add_event_handler:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
void **add_event_handler** **(** StringName event, Callable handler **)**
2024-01-12 20:05:50 +00:00
2024-03-04 20:36:16 +00:00
Registers a `` handler `` to be called when `` event `` is dispatched.
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_call_on_enter:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
:ref: `LimboState<class_LimboState>` **call_on_enter** **(** Callable callable **)**
2024-01-12 20:05:50 +00:00
2024-03-04 20:36:16 +00:00
A chained method that connects the :ref: `entered<class_LimboState_signal_entered>` signal to a `` callable `` .
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_call_on_exit:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
:ref: `LimboState<class_LimboState>` **call_on_exit** **(** Callable callable **)**
2024-01-12 20:05:50 +00:00
2024-03-04 20:36:16 +00:00
A chained method that connects the :ref: `exited<class_LimboState_signal_exited>` signal to a `` callable `` .
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_call_on_update:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
:ref: `LimboState<class_LimboState>` **call_on_update** **(** Callable callable **)**
2024-01-12 20:05:50 +00:00
2024-03-04 20:36:16 +00:00
A chained method that connects the :ref: `updated<class_LimboState_signal_updated>` signal to a `` callable `` .
2024-01-12 20:05:50 +00:00
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_clear_guard:
.. rst-class :: classref-method
void **clear_guard** **(** **)**
Clears the guard function, removing the `` Callable `` previously set by :ref: `set_guard<class_LimboState_method_set_guard>` .
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_dispatch:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
bool **dispatch** **(** StringName event, Variant cargo=null **)**
2024-01-12 20:05:50 +00:00
2024-03-04 20:36:16 +00:00
Recursively dispatches a state machine event named `` event `` with an optional argument `` cargo `` . Returns `` true `` if the event was consumed.
2024-01-12 20:05:50 +00:00
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 :ref: `add_event_handler<class_LimboState_method_add_event_handler>` .
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_get_root:
.. rst-class :: classref-method
:ref: `LimboState<class_LimboState>` **get_root** **(** **)** |const|
Returns the root **LimboState** .
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_is_active:
.. rst-class :: classref-method
bool **is_active** **(** **)** |const|
Returns `` true `` if it is currently active, meaning it is the active substate of the parent :ref: `LimboHSM<class_LimboHSM>` .
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_named:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
:ref: `LimboState<class_LimboState>` **named** **(** String name **)**
2024-01-12 20:05:50 +00:00
A chained method for setting the name of this state.
.. rst-class :: classref-item-separator
----
.. _class_LimboState_method_set_guard:
.. rst-class :: classref-method
2024-03-04 20:36:16 +00:00
void **set_guard** **(** Callable guard_callable **)**
2024-01-12 20:05:50 +00:00
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.
.. |virtual| replace :: :abbr: `virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace :: :abbr: `const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace :: :abbr: `vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace :: :abbr: `constructor (This method is used to construct a type.)`
.. |static| replace :: :abbr: `static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace :: :abbr: `operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace :: :abbr: `BitField (This value is an integer composed as a bitmask of the following flags.)`