limboai/doc/source/classes/class_limbohsm.rst

257 lines
10 KiB
ReStructuredText

: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/LimboHSM.xml.
.. _class_LimboHSM:
LimboHSM
========
**Inherits:** :ref:`LimboState<class_LimboState>`
Event-based Hierarchical State Machine (HSM).
.. rst-class:: classref-introduction-group
Description
-----------
Event-based Hierarchical State Machine (HSM) that manages :ref:`LimboState<class_LimboState>` instances and facilitates transitions between them. LimboHSM is a :ref:`LimboState<class_LimboState>` in itself and can also serve as a child of another LimboHSM node.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+---------------------------------------------+-------------------------------------------------------------+-------+
| :ref:`LimboState<class_LimboState>` | :ref:`ANYSTATE<class_LimboHSM_property_ANYSTATE>` | |
+---------------------------------------------+-------------------------------------------------------------+-------+
| :ref:`LimboState<class_LimboState>` | :ref:`initial_state<class_LimboHSM_property_initial_state>` | |
+---------------------------------------------+-------------------------------------------------------------+-------+
| :ref:`UpdateMode<enum_LimboHSM_UpdateMode>` | :ref:`update_mode<class_LimboHSM_property_update_mode>` | ``1`` |
+---------------------------------------------+-------------------------------------------------------------+-------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_transition<class_LimboHSM_method_add_transition>` **(** :ref:`LimboState<class_LimboState>` p_from_state, :ref:`LimboState<class_LimboState>` p_to_state, StringName p_event **)** |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`LimboState<class_LimboState>` | :ref:`get_active_state<class_LimboHSM_method_get_active_state>` **(** **)** |const| |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`LimboState<class_LimboState>` | :ref:`get_leaf_state<class_LimboHSM_method_get_leaf_state>` **(** **)** |const| |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`initialize<class_LimboHSM_method_initialize>` **(** Node p_agent, :ref:`Blackboard<class_Blackboard>` p_parent_scope=null **)** |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_active<class_LimboHSM_method_set_active>` **(** bool p_active **)** |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`update<class_LimboHSM_method_update>` **(** float p_delta **)** |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_LimboHSM_signal_state_changed:
.. rst-class:: classref-signal
**state_changed** **(** :ref:`LimboState<class_LimboState>` p_state **)**
Emitted when the currently active substate is switched to a different substate.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_LimboHSM_UpdateMode:
.. rst-class:: classref-enumeration
enum **UpdateMode**:
.. _class_LimboHSM_constant_IDLE:
.. rst-class:: classref-enumeration-constant
:ref:`UpdateMode<enum_LimboHSM_UpdateMode>` **IDLE** = ``0``
Update the state machine during the idle process.
.. _class_LimboHSM_constant_PHYSICS:
.. rst-class:: classref-enumeration-constant
:ref:`UpdateMode<enum_LimboHSM_UpdateMode>` **PHYSICS** = ``1``
Update the state machine during the physics process.
.. _class_LimboHSM_constant_MANUAL:
.. rst-class:: classref-enumeration-constant
:ref:`UpdateMode<enum_LimboHSM_UpdateMode>` **MANUAL** = ``2``
Manually update the state machine by calling :ref:`update<class_LimboHSM_method_update>` from a script.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_LimboHSM_property_ANYSTATE:
.. rst-class:: classref-property
:ref:`LimboState<class_LimboState>` **ANYSTATE**
.. rst-class:: classref-property-setget
- :ref:`LimboState<class_LimboState>` **anystate** **(** **)**
Useful for defining a transition from any state.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_property_initial_state:
.. rst-class:: classref-property
:ref:`LimboState<class_LimboState>` **initial_state**
.. rst-class:: classref-property-setget
- void **set_initial_state** **(** :ref:`LimboState<class_LimboState>` value **)**
- :ref:`LimboState<class_LimboState>` **get_initial_state** **(** **)**
The substate that becomes active when the state machine is activated using the :ref:`set_active<class_LimboHSM_method_set_active>` method. If not explicitly set, the first child of the LimboHSM will be considered the initial state.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_property_update_mode:
.. rst-class:: classref-property
:ref:`UpdateMode<enum_LimboHSM_UpdateMode>` **update_mode** = ``1``
.. rst-class:: classref-property-setget
- void **set_update_mode** **(** :ref:`UpdateMode<enum_LimboHSM_UpdateMode>` value **)**
- :ref:`UpdateMode<enum_LimboHSM_UpdateMode>` **get_update_mode** **(** **)**
Specifies when the state machine should be updated. See :ref:`UpdateMode<enum_LimboHSM_UpdateMode>`.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_LimboHSM_method_add_transition:
.. rst-class:: classref-method
void **add_transition** **(** :ref:`LimboState<class_LimboState>` p_from_state, :ref:`LimboState<class_LimboState>` p_to_state, StringName p_event **)**
Establishes a transition from one state to another when ``p_event`` is dispatched. Both ``p_from_state`` and ``p_to_state`` must be immediate children of this state.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_method_get_active_state:
.. rst-class:: classref-method
:ref:`LimboState<class_LimboState>` **get_active_state** **(** **)** |const|
Returns the currently active substate.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_method_get_leaf_state:
.. rst-class:: classref-method
:ref:`LimboState<class_LimboState>` **get_leaf_state** **(** **)** |const|
Returns the currently active leaf state within the state machine.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_method_initialize:
.. rst-class:: classref-method
void **initialize** **(** Node p_agent, :ref:`Blackboard<class_Blackboard>` p_parent_scope=null **)**
Initiates the state and calls :ref:`LimboState._setup<class_LimboState_private_method__setup>` for both itself and all substates.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_method_set_active:
.. rst-class:: classref-method
void **set_active** **(** bool p_active **)**
When set to ``true``, switches the state to :ref:`initial_state<class_LimboHSM_property_initial_state>` and activates state processing according to :ref:`update_mode<class_LimboHSM_property_update_mode>`.
.. rst-class:: classref-item-separator
----
.. _class_LimboHSM_method_update:
.. rst-class:: classref-method
void **update** **(** float p_delta **)**
Calls :ref:`LimboState._update<class_LimboState_private_method__update>` on itself and the active substate, with the call cascading down to the leaf state. This method is automatically triggered if :ref:`update_mode<class_LimboHSM_property_update_mode>` is not set to :ref:`MANUAL<class_LimboHSM_constant_MANUAL>`.
.. |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.)`