This commit is contained in:
kevinz000
2020-04-13 05:31:54 -07:00
parent 776ece46e1
commit 6313886e0c
5 changed files with 4 additions and 24 deletions

View File

@@ -4,11 +4,6 @@
var/list/observer_events
/atom/Destroy()
var/list/destroy_listeners = get_listener_list_from_event(OBSERVER_EVENT_DESTROY)
if(destroy_listeners)
for(var/destroy_listener in destroy_listeners)
call(destroy_listener, destroy_listeners[destroy_listener])(src)
for(var/list/listeners in observer_events)
listeners.Cut()

View File

@@ -1,14 +0,0 @@
// Observer Pattern Implementation: Destroyed
// Registration type: /datum
//
// Raised when: A /datum instance is destroyed.
//
// Arguments that the called proc should expect:
// /datum/destroyed_instance: The instance that was destroyed.
GLOBAL_DATUM_INIT(destroyed_event, /decl/observ/destroyed, new)
/decl/observ/destroyed
name = "Destroyed"
/datum/Destroy()
GLOB.destroyed_event?.raise_event(src)
. = ..()

View File

@@ -125,7 +125,7 @@
watching_mob = user
GLOB.moved_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
GLOB.dir_set_event.register(watching_mob, src, /obj/machinery/station_map/proc/checkPosition)
GLOB.destroyed_event.register(watching_mob, src, /obj/machinery/station_map/proc/stopWatching)
RegisterSignal(watching_mob, COMSIG_PARENT_QDELETING, .proc/stopWatching)
update_use_power(2)
if(bogus)
@@ -154,7 +154,7 @@
M.client.images -= holomap_datum.station_map
GLOB.moved_event.unregister(watching_mob, src)
GLOB.dir_set_event.unregister(watching_mob, src)
GLOB.destroyed_event.unregister(watching_mob, src)
UnregisterSignal(watching_mob, COMSIG_PARENT_QDELETING)
watching_mob = null
update_use_power(1)

View File

@@ -188,14 +188,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, /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade)
RegisterSignal(attached_grenade, COMSIG_PARENT_QDELETING, .proc/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, /obj/item/integrated_circuit/manipulation/grenade/proc/detach_grenade)
UnregisterSignal(attached_grenade, COMSIG_PARENT_QDELETING)
attached_grenade = null
size = initial(size)
desc = initial(desc)

View File

@@ -361,7 +361,6 @@
#include "code\datums\looping_sounds\weather_sounds.dm"
#include "code\datums\observation\_debug.dm"
#include "code\datums\observation\_defines.dm"
#include "code\datums\observation\destroyed.dm"
#include "code\datums\observation\dir_set.dm"
#include "code\datums\observation\equipped.dm"
#include "code\datums\observation\helpers.dm"