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 21:51:18 +00:00
committed by GitHub
parent ce0f722f18
commit 513facdb0d
25 changed files with 120 additions and 56 deletions
@@ -92,14 +92,14 @@
/obj/item/mecha_equipment/mounted_system/proc/forget_holding()
if(holding) //It'd be strange for this to be called with this var unset
GLOB.destroyed_event.unregister(holding, src, PROC_REF(forget_holding))
UnregisterSignal(holding, COMSIG_QDELETING)
holding = null
/obj/item/mecha_equipment/mounted_system/Initialize()
. = ..()
if(holding_type)
holding = new holding_type(src)
GLOB.destroyed_event.register(holding, src, PROC_REF(forget_holding))
RegisterSignal(holding, COMSIG_QDELETING, PROC_REF(forget_holding))
if(holding)
if(!icon_state)
icon = holding.icon
@@ -265,7 +265,7 @@
/obj/item/mecha_equipment/catapult/proc/beamdestroyed()
if(beam)
GLOB.destroyed_event.unregister(beam, src, .proc/beamdestroyed)
UnregisterSignal(beam, COMSIG_QDELETING)
beam = null
if(locked)
if(owner)
@@ -316,7 +316,7 @@
return
locked = AM
beam = owner.Beam(BeamTarget = target, icon_state = "r_beam", maxdistance = max_dist, beam_type = /obj/effect/ebeam/warp)
GLOB.destroyed_event.register(beam, src, .proc/beamdestroyed)
RegisterSignal(beam, COMSIG_QDELETING, PROC_REF(beamdestroyed))
animate(target,pixel_y= initial(target.pixel_y) - 2,time=1 SECOND, easing = SINE_EASING, flags = ANIMATION_PARALLEL, loop = -1)
animate(pixel_y= initial(target.pixel_y) + 2,time=1 SECOND)
@@ -100,7 +100,7 @@
if(target == selected_hardpoint)
clear_selected_hardpoint()
GLOB.destroyed_event.unregister(module_to_forget, src, PROC_REF(forget_module))
UnregisterSignal(module_to_forget, COMSIG_QDELETING)
var/atom/movable/screen/mecha/hardpoint/H = hardpoint_hud_elements[target]
H.holding = null
@@ -144,7 +144,7 @@
if(!found)
return FALSE
ME.installed(src)
GLOB.destroyed_event.register(system, src, PROC_REF(forget_module))
RegisterSignal(system, COMSIG_QDELETING, PROC_REF(forget_module))
system.forceMove(src)
@@ -198,7 +198,7 @@
system.forceMove(get_turf(src))
system.screen_loc = null
system.layer = initial(system.layer)
GLOB.destroyed_event.unregister(system, src, PROC_REF(forget_module))
UnregisterSignal(system, COMSIG_QDELETING)
var/atom/movable/screen/mecha/hardpoint/H = hardpoint_hud_elements[system_hardpoint]
H.holding = null