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

View File

@@ -69,13 +69,13 @@
return
ClearValue()
value_to_set = new_value
GLOB.destroyed_event.register(value_to_set, src, /datum/build_mode/edit/proc/ClearValue)
RegisterSignal(value_to_set, COMSIG_QDELETING, /datum/build_mode/edit/proc/ClearValue)
/datum/build_mode/edit/proc/ClearValue(var/feedback)
if(!istype(value_to_set, /datum))
return
GLOB.destroyed_event.unregister(value_to_set, src, /datum/build_mode/edit/proc/ClearValue)
UnregisterSignal(value_to_set, COMSIG_QDELETING)
value_to_set = initial(value_to_set)
if(feedback)
Warn("The selected reference value was deleted. Default value restored.")

View File

@@ -33,14 +33,14 @@
ClearDestination()
destination = A
GLOB.destroyed_event.register(destination, src, /datum/build_mode/move_into/proc/ClearDestination)
RegisterSignal(destination, COMSIG_QDELETING, /datum/build_mode/move_into/proc/ClearDestination)
to_chat(user, SPAN_NOTICE("Will now move targets into \the [destination]."))
/datum/build_mode/move_into/proc/ClearDestination(var/feedback)
if(!destination)
return
GLOB.destroyed_event.unregister(destination, src, /datum/build_mode/move_into/proc/ClearDestination)
UnregisterSignal(destination, COMSIG_QDELETING)
destination = null
if(feedback)
Warn("The selected destination was deleted.")