399 lines
16 KiB
ReStructuredText
399 lines
16 KiB
ReStructuredText
: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<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
|
|
|
|
+---------------------------------------------+-------------------------------------------------------------------+
|
|
| ``StringName`` | :ref:`EVENT_FINISHED<class_LimboState_property_EVENT_FINISHED>` |
|
|
+---------------------------------------------+-------------------------------------------------------------------+
|
|
| ``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>` |
|
|
+---------------------------------------------+-------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+
|
|
| |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>`\ (\ delta\: ``float``\ ) |virtual| |
|
|
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`add_event_handler<class_LimboState_method_add_event_handler>`\ (\ event\: ``StringName``, handler\: ``Callable``\ ) |
|
|
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+
|
|
| :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>`\ (\ event\: ``StringName``, cargo\: ``Variant`` = 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>`\ (\ name\: ``String``\ ) |
|
|
+-------------------------------------+---------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_guard<class_LimboState_method_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:`🔗<class_LimboState_signal_entered>`
|
|
|
|
Emitted when the state is entered.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_signal_exited:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**exited**\ (\ ) :ref:`🔗<class_LimboState_signal_exited>`
|
|
|
|
Emitted when the state is exited.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_signal_setup:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**setup**\ (\ ) :ref:`🔗<class_LimboState_signal_setup>`
|
|
|
|
Emitted when the state is initialized.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_signal_updated:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**updated**\ (\ delta\: ``float``\ ) :ref:`🔗<class_LimboState_signal_updated>`
|
|
|
|
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:`🔗<class_LimboState_property_EVENT_FINISHED>`
|
|
|
|
.. 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:`🔗<class_LimboState_property_agent>`
|
|
|
|
.. 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<class_Blackboard>` **blackboard** :ref:`🔗<class_LimboState_property_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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_property_blackboard_plan:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`BlackboardPlan<class_BlackboardPlan>` **blackboard_plan** :ref:`🔗<class_LimboState_property_blackboard_plan>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_blackboard_plan**\ (\ value\: :ref:`BlackboardPlan<class_BlackboardPlan>`\ )
|
|
- :ref:`BlackboardPlan<class_BlackboardPlan>` **get_blackboard_plan**\ (\ )
|
|
|
|
Stores and manages variables that will be used in constructing new :ref:`Blackboard<class_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:`🔗<class_LimboState_private_method__enter>`
|
|
|
|
Called when the state is entered.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_private_method__exit:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **_exit**\ (\ ) |virtual| :ref:`🔗<class_LimboState_private_method__exit>`
|
|
|
|
Called when the state is exited.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_private_method__setup:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **_setup**\ (\ ) |virtual| :ref:`🔗<class_LimboState_private_method__setup>`
|
|
|
|
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:`🔗<class_LimboState_private_method__update>`
|
|
|
|
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:`🔗<class_LimboState_method_add_event_handler>`
|
|
|
|
Registers a ``handler`` to be called when ``event`` is dispatched. The handler function should have the following signature:
|
|
|
|
::
|
|
|
|
func my_event_handler(cargo=null) -> void:
|
|
|
|
Cargo is an optional parameter that can be passed to the handler. See also :ref:`dispatch<class_LimboState_method_dispatch>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_method_call_on_enter:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`LimboState<class_LimboState>` **call_on_enter**\ (\ callable\: ``Callable``\ ) :ref:`🔗<class_LimboState_method_call_on_enter>`
|
|
|
|
A chained method that connects the :ref:`entered<class_LimboState_signal_entered>` signal to a ``callable``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_method_call_on_exit:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`LimboState<class_LimboState>` **call_on_exit**\ (\ callable\: ``Callable``\ ) :ref:`🔗<class_LimboState_method_call_on_exit>`
|
|
|
|
A chained method that connects the :ref:`exited<class_LimboState_signal_exited>` signal to a ``callable``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_method_call_on_update:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`LimboState<class_LimboState>` **call_on_update**\ (\ callable\: ``Callable``\ ) :ref:`🔗<class_LimboState_method_call_on_update>`
|
|
|
|
A chained method that connects the :ref:`updated<class_LimboState_signal_updated>` signal to a ``callable``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_method_clear_guard:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **clear_guard**\ (\ ) :ref:`🔗<class_LimboState_method_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
|
|
|
|
``bool`` **dispatch**\ (\ event\: ``StringName``, cargo\: ``Variant`` = null\ ) :ref:`🔗<class_LimboState_method_dispatch>`
|
|
|
|
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<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| :ref:`🔗<class_LimboState_method_get_root>`
|
|
|
|
Returns the root **LimboState**.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_LimboState_method_is_active:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
``bool`` **is_active**\ (\ ) |const| :ref:`🔗<class_LimboState_method_is_active>`
|
|
|
|
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
|
|
|
|
:ref:`LimboState<class_LimboState>` **named**\ (\ name\: ``String``\ ) :ref:`🔗<class_LimboState_method_named>`
|
|
|
|
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:`🔗<class_LimboState_method_set_guard>`
|
|
|
|
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.)`
|