:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/modules/limboai/doc_classes/LimboHSM.xml. .. _class_LimboHSM: LimboHSM ======== **Inherits:** :ref:`LimboState` Event-based Hierarchical State Machine (HSM). .. rst-class:: classref-introduction-group Description ----------- Event-based Hierarchical State Machine (HSM) that manages :ref:`LimboState` instances and facilitates transitions between them. LimboHSM is a :ref:`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` | :ref:`ANYSTATE` | | +---------------------------------------------+-------------------------------------------------------------+-------+ | :ref:`LimboState` | :ref:`initial_state` | | +---------------------------------------------+-------------------------------------------------------------+-------+ | :ref:`UpdateMode` | :ref:`update_mode` | ``1`` | +---------------------------------------------+-------------------------------------------------------------+-------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_transition`\ (\ from_state\: :ref:`LimboState`, to_state\: :ref:`LimboState`, event\: ``StringName``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`change_active_state`\ (\ state\: :ref:`LimboState`\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`get_active_state`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`get_leaf_state`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`get_previous_active_state`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ``bool`` | :ref:`has_transition`\ (\ from_state\: :ref:`LimboState`, event\: ``StringName``\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`initialize`\ (\ agent\: ``Node``, parent_scope\: :ref:`Blackboard` = null\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_transition`\ (\ from_state\: :ref:`LimboState`, event\: ``StringName``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_active`\ (\ active\: ``bool``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`update`\ (\ delta\: ``float``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_LimboHSM_signal_active_state_changed: .. rst-class:: classref-signal **active_state_changed**\ (\ current\: :ref:`LimboState`, previous\: :ref:`LimboState`\ ) :ref:`🔗` 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**: :ref:`🔗` .. _class_LimboHSM_constant_IDLE: .. rst-class:: classref-enumeration-constant :ref:`UpdateMode` **IDLE** = ``0`` Update the state machine during the idle process. .. _class_LimboHSM_constant_PHYSICS: .. rst-class:: classref-enumeration-constant :ref:`UpdateMode` **PHYSICS** = ``1`` Update the state machine during the physics process. .. _class_LimboHSM_constant_MANUAL: .. rst-class:: classref-enumeration-constant :ref:`UpdateMode` **MANUAL** = ``2`` Manually update the state machine by calling :ref:`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` **ANYSTATE** :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`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` **initial_state** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_initial_state**\ (\ value\: :ref:`LimboState`\ ) - :ref:`LimboState` **get_initial_state**\ (\ ) The substate that becomes active when the state machine is activated using the :ref:`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` **update_mode** = ``1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_update_mode**\ (\ value\: :ref:`UpdateMode`\ ) - :ref:`UpdateMode` **get_update_mode**\ (\ ) Specifies when the state machine should be updated. See :ref:`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**\ (\ from_state\: :ref:`LimboState`, to_state\: :ref:`LimboState`, event\: ``StringName``\ ) :ref:`🔗` Establishes a transition from one state to another when ``event`` is dispatched. Both ``from_state`` and ``to_state`` must be immediate children of this state. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_change_active_state: .. rst-class:: classref-method |void| **change_active_state**\ (\ state\: :ref:`LimboState`\ ) :ref:`🔗` Changes the currently active substate to ``state``. If ``state`` is already active, it will be exited and reentered. \ ``state`` must be a child of this **LimboHSM**. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_get_active_state: .. rst-class:: classref-method :ref:`LimboState` **get_active_state**\ (\ ) |const| :ref:`🔗` Returns the currently active substate. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_get_leaf_state: .. rst-class:: classref-method :ref:`LimboState` **get_leaf_state**\ (\ ) |const| :ref:`🔗` Returns the currently active leaf state within the state machine. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_get_previous_active_state: .. rst-class:: classref-method :ref:`LimboState` **get_previous_active_state**\ (\ ) |const| :ref:`🔗` Returns the previously active substate. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_has_transition: .. rst-class:: classref-method ``bool`` **has_transition**\ (\ from_state\: :ref:`LimboState`, event\: ``StringName``\ ) |const| :ref:`🔗` Returns ``true`` if there is a transition from ``from_state`` for a given ``event``. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_initialize: .. rst-class:: classref-method |void| **initialize**\ (\ agent\: ``Node``, parent_scope\: :ref:`Blackboard` = null\ ) :ref:`🔗` Initiates the state and calls :ref:`LimboState._setup` for both itself and all substates. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_remove_transition: .. rst-class:: classref-method |void| **remove_transition**\ (\ from_state\: :ref:`LimboState`, event\: ``StringName``\ ) :ref:`🔗` Removes a transition from a state associated with specific ``event``. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_set_active: .. rst-class:: classref-method |void| **set_active**\ (\ active\: ``bool``\ ) :ref:`🔗` When set to ``true``, switches the state to :ref:`initial_state` and activates state processing according to :ref:`update_mode`. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_update: .. rst-class:: classref-method |void| **update**\ (\ delta\: ``float``\ ) :ref:`🔗` Calls :ref:`LimboState._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` is not set to :ref:`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.)` .. |void| replace:: :abbr:`void (No return value.)`