Doc: Clarify `LimboState.add_event_handler()`

This commit is contained in:
Serhii Snitsaruk 2024-08-05 17:09:55 +02:00
parent 63de416066
commit a56272a248
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
2 changed files with 9 additions and 2 deletions

View File

@ -270,7 +270,12 @@ Called during the update. Implement your state's behavior with this method.
|void| **add_event_handler**\ (\ event\: ``StringName``, handler\: ``Callable``\ ) :ref:`🔗<class_LimboState_method_add_event_handler>` |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. 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 .. rst-class:: classref-item-separator

View File

@ -41,7 +41,9 @@
<param index="0" name="event" type="StringName" /> <param index="0" name="event" type="StringName" />
<param index="1" name="handler" type="Callable" /> <param index="1" name="handler" type="Callable" />
<description> <description>
Registers a [param handler] to be called when [param event] is dispatched. Registers a [param handler] to be called when [param event] is dispatched. The handler function should have the following signature:
[codeblock]func my_event_handler(cargo=null) -> void:[/codeblock]
Cargo is an optional parameter that can be passed to the handler. See also [method dispatch].
</description> </description>
</method> </method>
<method name="call_on_enter"> <method name="call_on_enter">