Improved signal handling

This commit is contained in:
Eduard Urbach 2024-02-06 21:55:22 +01:00
parent 4ad50e75db
commit fba99ed432
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -3,21 +3,12 @@ extends Control
signal chat_message_submitted(message: String)
var signals := [
"login",
"logout",
"ping_changed",
"download_changed",
"upload_changed",
"message_received",
]
var login: Signal
var logout: Signal
var ping_changed: Signal
var download_changed: Signal
var upload_changed: Signal
var message_received: Signal
@export var login: Signal
@export var logout: Signal
@export var ping_changed: Signal
@export var download_changed: Signal
@export var upload_changed: Signal
@export var message_received: Signal
func _enter_tree():
if get_node_or_null("/root/Main"):
@ -34,6 +25,9 @@ func connect_main_scene():
message_received = %Chat.message_received
func connect_fake():
for signal_name in signals:
set(signal_name, Signal(self, signal_name))
add_user_signal(signal_name)
for property in get_property_list():
if property.type != TYPE_SIGNAL:
continue
add_user_signal(property.name)
set(property.name, Signal(self, property.name))