How can I "raise" or "replicate" a signal?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DasVaca

So I have a World instancing a Player, and the Player has states as nodes.

What I want is to “raise” a signal emited by one of the states node as if it was emited by the Player so the World only needs to interact with the Player and not its nodes.

I though just doing another emit_signal() because I don’t know if there’s a more elegant way to proceed.

:bust_in_silhouette: Reply From: tuon

It is possible to add a signal in code using the Object.add_user_signal() function. You could have the child nodes add signals to the parent node.

I have a project starter repository on github. It has something I call a Signal Manager, which allows you to register a publisher and subcribers of signals. (A publisher would be the object emitting the signal, while the subscriber is the object with a method connected to that signal.) If you use the Signal Manager, you could subscribe to the child’s signal in the World and register the children as publishers. Please see the readme on the github page for examples. The link the repository is https://github.com/jhlothamer/godot_project_starter.