Browse Source

Mention that signals are first-class types since Godot 4.0 in Using signals

(cherry picked from commit d23fe7bd8e9e8c0b39381f47762d88ede68a4b35)
Hugo Locurcio 1 year ago
parent
commit
52b408e4d3
1 changed files with 14 additions and 8 deletions
  1. 14 8
      getting_started/step_by_step/signals.rst

+ 14 - 8
getting_started/step_by_step/signals.rst

@@ -25,9 +25,17 @@ For example, you might have a life bar on the screen that represents the
 player's health. When the player takes damage or uses a healing potion, you want
 player's health. When the player takes damage or uses a healing potion, you want
 the bar to reflect the change. To do so, in Godot, you would use signals.
 the bar to reflect the change. To do so, in Godot, you would use signals.
 
 
-.. note:: As mentioned in the introduction, signals are Godot's version of the
-          observer pattern. You can learn more about it here:
-          https://gameprogrammingpatterns.com/observer.html
+Like methods (:ref:`class_callable`), signals are a first-class type since Godot
+4.0. This means you can pass them around as method arguments directly without
+having to pass them as strings, which allows for better autocompletion and is
+less error-prone. See the :ref:`class_signal` class reference for a list of
+what you can do with the Signal type directly.
+
+.. seealso::
+
+    As mentioned in the introduction, signals are Godot's version of the
+    observer pattern. You can learn more about it in
+    `Game Programming Patterns <https://gameprogrammingpatterns.com/observer.html>`__.
 
 
 We will now use a signal to make our Godot icon from the previous lesson
 We will now use a signal to make our Godot icon from the previous lesson
 (:ref:`doc_scripting_player_input`) move and stop by pressing a button.
 (:ref:`doc_scripting_player_input`) move and stop by pressing a button.
@@ -43,8 +51,6 @@ We will now use a signal to make our Godot icon from the previous lesson
             camelCase (See :ref:`doc_c_sharp_styleguide`). Be careful to type
             camelCase (See :ref:`doc_c_sharp_styleguide`). Be careful to type
             the method names precisely when connecting signals.
             the method names precisely when connecting signals.
 
 
-.. Example
-
 Scene setup
 Scene setup
 -----------
 -----------
 
 
@@ -139,10 +145,10 @@ methods "_on_node_name_signal_name". Here, it'll be "_on_button_pressed".
    toggle the mode in the window's bottom-right by clicking the Advanced
    toggle the mode in the window's bottom-right by clicking the Advanced
    button.
    button.
 
 
-.. note:: 
+.. note::
 
 
-    If you are using an external editor (such as VS Code) this 
-    automatic code generation might not work. In this case you need to to connect 
+    If you are using an external editor (such as VS Code) this
+    automatic code generation might not work. In this case you need to to connect
     the signal via code as explained in the next section.
     the signal via code as explained in the next section.
 
 
 Click the Connect button to complete the signal connection and jump to the
 Click the Connect button to complete the signal connection and jump to the