limboai/doc/source/classes/class_btcooldown.rst

150 lines
6.0 KiB
ReStructuredText
Raw 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/BTCooldown.xml.
.. _class_BTCooldown:
BTCooldown
==========
**Inherits:** :ref:`BTDecorator<class_BTDecorator>` **<** :ref:`BTTask<class_BTTask>` **<** :ref:`BT<class_BT>`
BT decorator that executes its child task only if :ref:`duration<class_BTCooldown_property_duration>` time has passed since the previous execution.
.. rst-class:: classref-introduction-group
Description
-----------
BTCooldown runs its child task only if :ref:`duration<class_BTCooldown_property_duration>` time has passed since the last successful child task execution. It will only consider successful executions unless :ref:`trigger_on_failure<class_BTCooldown_property_trigger_on_failure>` is set to ``true``.
Returns ``RUNNING``, if the child task results in ``RUNNING``.
Returns ``SUCCESS``, if the child task results in ``SUCCESS``, and triggers the cooldown timer.
Returns ``FAILURE``, if the child task results in ``FAILURE`` or if :ref:`duration<class_BTCooldown_property_duration>` time didn't pass since the previous execution.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
2024-07-20 15:25:24 +00:00
+----------------+-------------------------------------------------------------------------+-----------+
| ``StringName`` | :ref:`cooldown_state_var<class_BTCooldown_property_cooldown_state_var>` | ``&""`` |
+----------------+-------------------------------------------------------------------------+-----------+
| ``float`` | :ref:`duration<class_BTCooldown_property_duration>` | ``10.0`` |
+----------------+-------------------------------------------------------------------------+-----------+
| ``bool`` | :ref:`process_pause<class_BTCooldown_property_process_pause>` | ``false`` |
+----------------+-------------------------------------------------------------------------+-----------+
| ``bool`` | :ref:`start_cooled<class_BTCooldown_property_start_cooled>` | ``false`` |
+----------------+-------------------------------------------------------------------------+-----------+
| ``bool`` | :ref:`trigger_on_failure<class_BTCooldown_property_trigger_on_failure>` | ``false`` |
+----------------+-------------------------------------------------------------------------+-----------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_BTCooldown_property_cooldown_state_var:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``StringName`` **cooldown_state_var** = ``&""`` :ref:`🔗<class_BTCooldown_property_cooldown_state_var>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_cooldown_state_var**\ (\ value\: ``StringName``\ )
- ``StringName`` **get_cooldown_state_var**\ (\ )
A boolean variable used to store the cooldown state in the :ref:`Blackboard<class_Blackboard>`. If left empty, the variable will be automatically generated and assigned.
If the variable's value is set to ``true``, it indicates that the cooldown is activated. This feature is useful for checking the cooldown state from other parts of the tree or sharing it among different sections of the :ref:`BehaviorTree<class_BehaviorTree>`.
.. rst-class:: classref-item-separator
----
.. _class_BTCooldown_property_duration:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``float`` **duration** = ``10.0`` :ref:`🔗<class_BTCooldown_property_duration>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_duration**\ (\ value\: ``float``\ )
- ``float`` **get_duration**\ (\ )
Time to wait before permitting another child's execution.
.. rst-class:: classref-item-separator
----
.. _class_BTCooldown_property_process_pause:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``bool`` **process_pause** = ``false`` :ref:`🔗<class_BTCooldown_property_process_pause>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_process_pause**\ (\ value\: ``bool``\ )
- ``bool`` **get_process_pause**\ (\ )
If ``true``, process cooldown when the ``SceneTree`` is paused.
.. rst-class:: classref-item-separator
----
.. _class_BTCooldown_property_start_cooled:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``bool`` **start_cooled** = ``false`` :ref:`🔗<class_BTCooldown_property_start_cooled>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_start_cooled**\ (\ value\: ``bool``\ )
- ``bool`` **get_start_cooled**\ (\ )
If ``true``, initiate a cooldown as if the child had been executed before the first BT tick.
.. rst-class:: classref-item-separator
----
.. _class_BTCooldown_property_trigger_on_failure:
.. rst-class:: classref-property
2024-07-20 15:25:24 +00:00
``bool`` **trigger_on_failure** = ``false`` :ref:`🔗<class_BTCooldown_property_trigger_on_failure>`
.. rst-class:: classref-property-setget
2024-07-20 15:25:24 +00:00
- |void| **set_trigger_on_failure**\ (\ value\: ``bool``\ )
- ``bool`` **get_trigger_on_failure**\ (\ )
If ``true``, the cooldown will be activated if the child task also returns ``FAILURE``. Otherwise, the cooldown will only be triggered when the child task returns ``SUCCESS``.
.. |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.)`