Refactored deletion observables to use the COMSIG_QDELETING signal (#20121)

Refactored deletion observables to use the COMSIG_QDELETING signal
instead, removed the observable.
This commit is contained in:
Fluffy
2024-11-04 22:51:18 +01:00
committed by GitHub
parent ce0f722f18
commit 513facdb0d
25 changed files with 120 additions and 56 deletions
-1
View File
@@ -104,7 +104,6 @@
#endif
#endif
GLOB.destroyed_event.raise_event(src)
if (!isturf(src))
cleanup_events(src)
-4
View File
@@ -1,4 +0,0 @@
GLOBAL_DATUM_INIT(destroyed_event, /singleton/observ/destroyed, new)
/singleton/observ/destroyed
name = "Destroyed"
+4 -4
View File
@@ -114,7 +114,7 @@ GLOBAL_DATUM_INIT(sound_player, /singleton/sound_player, new)
listeners = list()
listener_status = list()
GLOB.destroyed_event.register(source, src, /datum/proc/qdel_self)
RegisterSignal(source, COMSIG_QDELETING, TYPE_PROC_REF(/datum, qdel_self))
PrivLocateListeners()
START_PROCESSING(SSprocessing, src)
@@ -154,7 +154,7 @@ GLOBAL_DATUM_INIT(sound_player, /singleton/sound_player, new)
listeners = null
listener_status = null
GLOB.destroyed_event.unregister(source, src, /datum/proc/qdel_self)
UnregisterSignal(source, COMSIG_QDELETING)
source = null
GLOB.sound_player.PrivStopSound(src)
@@ -198,7 +198,7 @@ GLOBAL_DATUM_INIT(sound_player, /singleton/sound_player, new)
listeners += listener
RegisterSignal(listener, COMSIG_MOVABLE_MOVED, PROC_REF(PrivUpdateListenerLoc))
GLOB.destroyed_event.register(listener, src, PROC_REF(PrivRemoveListener))
RegisterSignal(listener, COMSIG_QDELETING, PROC_REF(PrivRemoveListener))
PrivUpdateListenerLoc(listener, update_sound = FALSE)
@@ -206,7 +206,7 @@ GLOBAL_DATUM_INIT(sound_player, /singleton/sound_player, new)
null_sound = null_sound || new(channel = sound.channel)
sound_to(listener, null_sound)
UnregisterSignal(listener, COMSIG_MOVABLE_MOVED)
GLOB.destroyed_event.unregister(listener, src, PROC_REF(PrivRemoveListener))
UnregisterSignal(listener, COMSIG_QDELETING)
listeners -= listener
/datum/sound_token/proc/PrivUpdateListenerLoc(atom/movable/listener, atom/old_loc, dir, forced, list/old_locs, update_sound = TRUE)