286 lines
9.9 KiB
ReStructuredText
286 lines
9.9 KiB
ReStructuredText
: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/BTPlayer.xml.
|
|
|
|
.. _class_BTPlayer:
|
|
|
|
BTPlayer
|
|
========
|
|
|
|
**Inherits:**
|
|
|
|
Player of :ref:`BehaviorTree<class_BehaviorTree>` resources.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
BTPlayer node is used for the instantiation and playback of :ref:`BehaviorTree<class_BehaviorTree>` resources at runtime. During instantiation, the behavior tree instance is initialized with a reference to the agent and the :ref:`blackboard<class_BTPlayer_property_blackboard>`. Agent is the owner of the BTPlayer node (see :ref:`Node.owner<class_Node_member_owner>`).
|
|
|
|
For an introduction to behavior trees, see :ref:`BehaviorTree<class_BehaviorTree>`.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
| bool | :ref:`active<class_BTPlayer_property_active>` | ``true`` |
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
| :ref:`BehaviorTree<class_BehaviorTree>` | :ref:`behavior_tree<class_BTPlayer_property_behavior_tree>` | |
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
| :ref:`Blackboard<class_Blackboard>` | :ref:`blackboard<class_BTPlayer_property_blackboard>` | |
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
| bool | :ref:`monitor_performance<class_BTPlayer_property_monitor_performance>` | ``false`` |
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
| bool | :ref:`prefetch_nodepath_vars<class_BTPlayer_property_prefetch_nodepath_vars>` | ``true`` |
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
| :ref:`UpdateMode<enum_BTPlayer_UpdateMode>` | :ref:`update_mode<class_BTPlayer_property_update_mode>` | ``1`` |
|
|
+---------------------------------------------+-------------------------------------------------------------------------------+-----------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+------+-----------------------------------------------------------------------------------+
|
|
| int | :ref:`get_last_status<class_BTPlayer_method_get_last_status>` **(** **)** |const| |
|
|
+------+-----------------------------------------------------------------------------------+
|
|
| void | :ref:`restart<class_BTPlayer_method_restart>` **(** **)** |
|
|
+------+-----------------------------------------------------------------------------------+
|
|
| void | :ref:`update<class_BTPlayer_method_update>` **(** float p_delta **)** |
|
|
+------+-----------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Signals
|
|
-------
|
|
|
|
.. _class_BTPlayer_signal_behavior_tree_finished:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**behavior_tree_finished** **(** int p_status **)**
|
|
|
|
Emitted when the behavior tree has finished executing and returned ``SUCCESS`` or ``FAILURE``.
|
|
|
|
Argument ``p_status`` holds the status returned by the behavior tree. See :ref:`Status<enum_BT_Status>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_signal_updated:
|
|
|
|
.. rst-class:: classref-signal
|
|
|
|
**updated** **(** int p_status **)**
|
|
|
|
Emitted when BTPlayer has finished the behavior tree update.
|
|
|
|
Argument ``p_status`` holds the status returned by the behavior tree. See :ref:`Status<enum_BT_Status>`.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_BTPlayer_UpdateMode:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **UpdateMode**:
|
|
|
|
.. _class_BTPlayer_constant_IDLE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`UpdateMode<enum_BTPlayer_UpdateMode>` **IDLE** = ``0``
|
|
|
|
Execute behavior tree during the idle process.
|
|
|
|
.. _class_BTPlayer_constant_PHYSICS:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`UpdateMode<enum_BTPlayer_UpdateMode>` **PHYSICS** = ``1``
|
|
|
|
Execute behavior tree during the physics process.
|
|
|
|
.. _class_BTPlayer_constant_MANUAL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`UpdateMode<enum_BTPlayer_UpdateMode>` **MANUAL** = ``2``
|
|
|
|
Behavior tree is executed manually by calling :ref:`update<class_BTPlayer_method_update>`.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_BTPlayer_property_active:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
bool **active** = ``true``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_active** **(** bool value **)**
|
|
- bool **get_active** **(** **)**
|
|
|
|
If ``true``, the behavior tree will be executed during update.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_property_behavior_tree:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`BehaviorTree<class_BehaviorTree>` **behavior_tree**
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_behavior_tree** **(** :ref:`BehaviorTree<class_BehaviorTree>` value **)**
|
|
- :ref:`BehaviorTree<class_BehaviorTree>` **get_behavior_tree** **(** **)**
|
|
|
|
:ref:`BehaviorTree<class_BehaviorTree>` resource to instantiate and execute at runtime.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_property_blackboard:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Blackboard<class_Blackboard>` **blackboard**
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_blackboard** **(** :ref:`Blackboard<class_Blackboard>` value **)**
|
|
- :ref:`Blackboard<class_Blackboard>` **get_blackboard** **(** **)**
|
|
|
|
Holds data shared by the behavior tree tasks. See :ref:`Blackboard<class_Blackboard>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_property_monitor_performance:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
bool **monitor_performance** = ``false``
|
|
|
|
If ``true``, adds a performance monitor to "Debugger->Monitors" for each instance of this **BTPlayer** node.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_property_prefetch_nodepath_vars:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
bool **prefetch_nodepath_vars** = ``true``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_prefetch_nodepath_vars** **(** bool value **)**
|
|
- bool **get_prefetch_nodepath_vars** **(** **)**
|
|
|
|
If ``true``, any ``NodePath`` variables in the :ref:`Blackboard<class_Blackboard>` are replaced with ``Node`` references when the tree is instantiated. References are retrieved by calling :ref:`Node.get_node<class_Node_method_get_node>` on the agent instance (agent is the owner of the BTPlayer node).
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_property_update_mode:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`UpdateMode<enum_BTPlayer_UpdateMode>` **update_mode** = ``1``
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- void **set_update_mode** **(** :ref:`UpdateMode<enum_BTPlayer_UpdateMode>` value **)**
|
|
- :ref:`UpdateMode<enum_BTPlayer_UpdateMode>` **get_update_mode** **(** **)**
|
|
|
|
Determines when the behavior tree is executed. See :ref:`UpdateMode<enum_BTPlayer_UpdateMode>`.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_BTPlayer_method_get_last_status:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
int **get_last_status** **(** **)** |const|
|
|
|
|
Returns the behavior tree's last execution status. See :ref:`Status<enum_BT_Status>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_method_restart:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **restart** **(** **)**
|
|
|
|
Resets the behavior tree's execution. Each running task will be aborted and the next tree execution will start anew. This method does not reset :ref:`Blackboard<class_Blackboard>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_BTPlayer_method_update:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
void **update** **(** float p_delta **)**
|
|
|
|
Executes the root task of the behavior tree instance if :ref:`active<class_BTPlayer_property_active>` is ``true``. Call this method when :ref:`update_mode<class_BTPlayer_property_update_mode>` is set to :ref:`MANUAL<class_BTPlayer_constant_MANUAL>`. When :ref:`update_mode<class_BTPlayer_property_update_mode>` is not :ref:`MANUAL<class_BTPlayer_constant_MANUAL>`, the :ref:`update<class_BTPlayer_method_update>` will be called automatically. See :ref:`UpdateMode<enum_BTPlayer_UpdateMode>`.
|
|
|
|
.. |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.)`
|