: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/LimboState.xml. .. _class_LimboState: LimboState ========== **Inherits:** **Inherited By:** :ref:`BTState`, :ref:`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`, :ref:`_exit`, :ref:`_setup`, and :ref:`_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`. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------------------------+-------------------------------------------------------------------+ | ``StringName`` | :ref:`EVENT_FINISHED` | +---------------------------------------------+-------------------------------------------------------------------+ | ``Node`` | :ref:`agent` | +---------------------------------------------+-------------------------------------------------------------------+ | :ref:`Blackboard` | :ref:`blackboard` | +---------------------------------------------+-------------------------------------------------------------------+ | :ref:`BlackboardPlan` | :ref:`blackboard_plan` | +---------------------------------------------+-------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`_enter`\ (\ ) |virtual| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`_exit`\ (\ ) |virtual| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`_setup`\ (\ ) |virtual| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`_update`\ (\ delta\: ``float``\ ) |virtual| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_event_handler`\ (\ event\: ``StringName``, handler\: ``Callable``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`call_on_enter`\ (\ callable\: ``Callable``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`call_on_exit`\ (\ callable\: ``Callable``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`call_on_update`\ (\ callable\: ``Callable``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`clear_guard`\ (\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | ``bool`` | :ref:`dispatch`\ (\ event\: ``StringName``, cargo\: ``Variant`` = null\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`get_root`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | ``bool`` | :ref:`is_active`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | :ref:`LimboState` | :ref:`named`\ (\ name\: ``String``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_guard`\ (\ guard_callable\: ``Callable``\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_LimboState_signal_entered: .. rst-class:: classref-signal **entered**\ (\ ) :ref:`🔗` Emitted when the state is entered. .. rst-class:: classref-item-separator ---- .. _class_LimboState_signal_exited: .. rst-class:: classref-signal **exited**\ (\ ) :ref:`🔗` Emitted when the state is exited. .. rst-class:: classref-item-separator ---- .. _class_LimboState_signal_setup: .. rst-class:: classref-signal **setup**\ (\ ) :ref:`🔗` Emitted when the state is initialized. .. rst-class:: classref-item-separator ---- .. _class_LimboState_signal_updated: .. rst-class:: classref-signal **updated**\ (\ delta\: ``float``\ ) :ref:`🔗` 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 ``StringName`` **EVENT_FINISHED** :ref:`🔗` .. rst-class:: classref-property-setget - ``StringName`` **event_finished**\ (\ ) 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** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_agent**\ (\ value\: ``Node``\ ) - ``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` **blackboard** :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`Blackboard` **get_blackboard**\ (\ ) A key/value data store shared by states within the state machine to which this state belongs. .. rst-class:: classref-item-separator ---- .. _class_LimboState_property_blackboard_plan: .. rst-class:: classref-property :ref:`BlackboardPlan` **blackboard_plan** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_blackboard_plan**\ (\ value\: :ref:`BlackboardPlan`\ ) - :ref:`BlackboardPlan` **get_blackboard_plan**\ (\ ) Stores and manages variables that will be used in constructing new :ref:`Blackboard` instances. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_LimboState_private_method__enter: .. rst-class:: classref-method |void| **_enter**\ (\ ) |virtual| :ref:`🔗` Called when the state is entered. .. rst-class:: classref-item-separator ---- .. _class_LimboState_private_method__exit: .. rst-class:: classref-method |void| **_exit**\ (\ ) |virtual| :ref:`🔗` Called when the state is exited. .. rst-class:: classref-item-separator ---- .. _class_LimboState_private_method__setup: .. rst-class:: classref-method |void| **_setup**\ (\ ) |virtual| :ref:`🔗` 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 |void| **_update**\ (\ delta\: ``float``\ ) |virtual| :ref:`🔗` 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 |void| **add_event_handler**\ (\ event\: ``StringName``, handler\: ``Callable``\ ) :ref:`🔗` Registers a ``handler`` to be called when ``event`` is dispatched. The handler function should have the following signature: :: func my_event_handler(cargo=null) -> bool: Cargo is an optional parameter that can be passed to the handler. See also :ref:`dispatch`. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_call_on_enter: .. rst-class:: classref-method :ref:`LimboState` **call_on_enter**\ (\ callable\: ``Callable``\ ) :ref:`🔗` A chained method that connects the :ref:`entered` signal to a ``callable``. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_call_on_exit: .. rst-class:: classref-method :ref:`LimboState` **call_on_exit**\ (\ callable\: ``Callable``\ ) :ref:`🔗` A chained method that connects the :ref:`exited` signal to a ``callable``. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_call_on_update: .. rst-class:: classref-method :ref:`LimboState` **call_on_update**\ (\ callable\: ``Callable``\ ) :ref:`🔗` A chained method that connects the :ref:`updated` signal to a ``callable``. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_clear_guard: .. rst-class:: classref-method |void| **clear_guard**\ (\ ) :ref:`🔗` Clears the guard function, removing the ``Callable`` previously set by :ref:`set_guard`. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_dispatch: .. rst-class:: classref-method ``bool`` **dispatch**\ (\ event\: ``StringName``, cargo\: ``Variant`` = null\ ) :ref:`🔗` Recursively dispatches a state machine event named ``event`` with an optional argument ``cargo``. Returns ``true`` 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 :ref:`add_event_handler`. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_get_root: .. rst-class:: classref-method :ref:`LimboState` **get_root**\ (\ ) |const| :ref:`🔗` Returns the root **LimboState**. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_is_active: .. rst-class:: classref-method ``bool`` **is_active**\ (\ ) |const| :ref:`🔗` Returns ``true`` if it is currently active, meaning it is the active substate of the parent :ref:`LimboHSM`. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_named: .. rst-class:: classref-method :ref:`LimboState` **named**\ (\ name\: ``String``\ ) :ref:`🔗` A chained method for setting the name of this state. .. rst-class:: classref-item-separator ---- .. _class_LimboState_method_set_guard: .. rst-class:: classref-method |void| **set_guard**\ (\ guard_callable\: ``Callable``\ ) :ref:`🔗` 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.)` .. |void| replace:: :abbr:`void (No return value.)`