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
@@ -170,14 +170,14 @@
// These procs do not relocate the grenade, that's the callers responsibility
/obj/item/integrated_circuit/manipulation/grenade/proc/attach_grenade(var/obj/item/grenade/G)
attached_grenade = G
GLOB.destroyed_event.register(attached_grenade, src, PROC_REF(detach_grenade))
RegisterSignal(attached_grenade, COMSIG_QDELETING, PROC_REF(detach_grenade))
size += G.w_class
desc += " \An [attached_grenade] is attached to it!"
/obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade()
if(!attached_grenade)
return
GLOB.destroyed_event.unregister(attached_grenade, src)
UnregisterSignal(attached_grenade, COMSIG_QDELETING)
attached_grenade = null
size = initial(size)
desc = initial(desc)