: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` 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` **(** :ref:`LimboState` p_from_state, :ref:`LimboState` p_to_state, String p_event **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`get_active_state` **(** **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`get_leaf_state` **(** **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`initialize` **(** Node p_agent, :ref:`Blackboard` p_parent_scope=null **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_active` **(** bool p_active **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`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` 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` **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** .. 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** .. rst-class:: classref-property-setget - void **set_initial_state** **(** :ref:`LimboState` value **)** - :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`` .. rst-class:: classref-property-setget - void **set_update_mode** **(** :ref:`UpdateMode` value **)** - :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** **(** :ref:`LimboState` p_from_state, :ref:`LimboState` p_to_state, String 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` **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` **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` p_parent_scope=null **)** Initiates the state and calls :ref:`LimboState._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` and activates state processing according to :ref:`update_mode`. .. rst-class:: classref-item-separator ---- .. _class_LimboHSM_method_update: .. rst-class:: classref-method void **update** **(** float p_delta **)** 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.)`