limboai/doc/source/classes/class_btstate.rst

166 lines
6.9 KiB
ReStructuredText
Raw Permalink Normal View History

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
2024-09-30 09:17:01 +00:00
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/limboai/doc_classes/BTState.xml.
.. _class_BTState:
BTState
=======
**Inherits:** :ref:`LimboState<class_LimboState>`
A state node for :ref:`LimboHSM<class_LimboHSM>` that hosts a :ref:`BehaviorTree<class_BehaviorTree>`.
.. rst-class:: classref-introduction-group
Description
-----------
BTState is a :ref:`LimboState<class_LimboState>` node that manages a :ref:`BehaviorTree<class_BehaviorTree>` to provide behavior logic for the state. It instantiates and runs the :ref:`BehaviorTree<class_BehaviorTree>` resource, dispatching a state machine event upon ``SUCCESS`` or ``FAILURE``. Event names are customizable through :ref:`success_event<class_BTState_property_success_event>` and :ref:`failure_event<class_BTState_property_failure_event>`. For further details on state machine events, see :ref:`LimboState.dispatch<class_LimboState_method_dispatch>`.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------------------+------------------------------------------------------------------------+----------------+
| :ref:`BehaviorTree<class_BehaviorTree>` | :ref:`behavior_tree<class_BTState_property_behavior_tree>` | |
+-----------------------------------------+------------------------------------------------------------------------+----------------+
| ``StringName`` | :ref:`failure_event<class_BTState_property_failure_event>` | ``&"failure"`` |
+-----------------------------------------+------------------------------------------------------------------------+----------------+
| ``bool`` | :ref:`monitor_performance<class_BTState_property_monitor_performance>` | ``false`` |
+-----------------------------------------+------------------------------------------------------------------------+----------------+
| ``StringName`` | :ref:`success_event<class_BTState_property_success_event>` | ``&"success"`` |
+-----------------------------------------+------------------------------------------------------------------------+----------------+
2024-02-14 19:34:18 +00:00
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
2024-08-05 11:21:57 +00:00
+-------------------------------------+---------------------------------------------------------------------------------------------------+
| :ref:`BTInstance<class_BTInstance>` | :ref:`get_bt_instance<class_BTState_method_get_bt_instance>`\ (\ ) |const| |
+-------------------------------------+---------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_scene_root_hint<class_BTState_method_set_scene_root_hint>`\ (\ scene_root\: ``Node``\ ) |
+-------------------------------------+---------------------------------------------------------------------------------------------------+
2024-02-14 19:34:18 +00:00
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_BTState_property_behavior_tree:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
:ref:`BehaviorTree<class_BehaviorTree>` **behavior_tree** :ref:`🔗<class_BTState_property_behavior_tree>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_behavior_tree**\ (\ value\: :ref:`BehaviorTree<class_BehaviorTree>`\ )
- :ref:`BehaviorTree<class_BehaviorTree>` **get_behavior_tree**\ (\ )
A :ref:`BehaviorTree<class_BehaviorTree>` resource that defines state behavior.
.. rst-class:: classref-item-separator
----
.. _class_BTState_property_failure_event:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``StringName`` **failure_event** = ``&"failure"`` :ref:`🔗<class_BTState_property_failure_event>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_failure_event**\ (\ value\: ``StringName``\ )
- ``StringName`` **get_failure_event**\ (\ )
HSM event that will be dispatched when the behavior tree results in ``FAILURE``. See :ref:`LimboState.dispatch<class_LimboState_method_dispatch>`.
.. rst-class:: classref-item-separator
----
.. _class_BTState_property_monitor_performance:
.. rst-class:: classref-property
``bool`` **monitor_performance** = ``false`` :ref:`🔗<class_BTState_property_monitor_performance>`
2024-09-30 09:17:01 +00:00
.. rst-class:: classref-property-setget
- |void| **set_monitor_performance**\ (\ value\: ``bool``\ )
- ``bool`` **get_monitor_performance**\ (\ )
If ``true``, adds a performance monitor to "Debugger->Monitors" for each instance of this **BTState** node.
.. rst-class:: classref-item-separator
----
.. _class_BTState_property_success_event:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``StringName`` **success_event** = ``&"success"`` :ref:`🔗<class_BTState_property_success_event>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_success_event**\ (\ value\: ``StringName``\ )
- ``StringName`` **get_success_event**\ (\ )
HSM event that will be dispatched when the behavior tree results in ``SUCCESS``. See :ref:`LimboState.dispatch<class_LimboState_method_dispatch>`.
2024-02-14 19:34:18 +00:00
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
2024-08-03 11:14:31 +00:00
.. _class_BTState_method_get_bt_instance:
2024-02-14 19:34:18 +00:00
.. rst-class:: classref-method
2024-08-03 11:14:31 +00:00
:ref:`BTInstance<class_BTInstance>` **get_bt_instance**\ (\ ) |const| :ref:`🔗<class_BTState_method_get_bt_instance>`
2024-02-14 19:34:18 +00:00
2024-08-03 11:14:31 +00:00
Returns the behavior tree instance.
2024-02-14 19:34:18 +00:00
2024-08-05 11:21:57 +00:00
.. rst-class:: classref-item-separator
----
.. _class_BTState_method_set_scene_root_hint:
.. rst-class:: classref-method
|void| **set_scene_root_hint**\ (\ scene_root\: ``Node``\ ) :ref:`🔗<class_BTState_method_set_scene_root_hint>`
Sets the ``Node`` that will be used as the scene root for the newly instantiated behavior tree. Should be called before the state machine is initialized. This is typically useful when creating **BTState** nodes dynamically from code.
.. |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.)`
2024-07-20 15:25:24 +00:00
.. |void| replace:: :abbr:`void (No return value.)`