This PR fixes some errors related to signals (already connected signal errors) by adding a new SignalUtils class with two static functions: ensure_connected (checks if the signal is already connected before trying to connect it) and ensure_disconnected (checks if the signal is not connected before trying to disconnect it). That way, there is no need to check manually if a given signal is connected to a given callable before connecting/disconnecting, which leads to clearer code.
On top of that, I've replaced Callable(self, function_name) by just function_name given it's clearer and Godot will be able to throw errors in the editor before you run the game, in case you made a typo.
This PR fixes some errors related to signals (already connected signal errors) by adding a new
SignalUtils
class with two static functions:ensure_connected
(checks if the signal is already connected before trying to connect it) andensure_disconnected
(checks if the signal is not connected before trying to disconnect it). That way, there is no need to check manually if a given signal is connected to a given callable before connecting/disconnecting, which leads to clearer code.On top of that, I've replaced
Callable(self, function_name)
by justfunction_name
given it's clearer and Godot will be able to throw errors in the editor before you run the game, in case you made a typo.