mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-22 11:36:38 +01:00
Unify datum var definitions
Inspired by https://github.com/tgstation/tgstation/pull/29636 Also consolidated some sideways overridden /datum/Delete() here to reduce proc-call overhead.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// datum defines!
|
||||
// Note: Adding vars to /datum adds a var to EVERYTHING! Don't go overboard.
|
||||
//
|
||||
|
||||
/datum
|
||||
var/gc_destroyed //Time when this object was destroyed.
|
||||
var/weakref/weakref // Holder of weakref instance pointing to this datum
|
||||
|
||||
#ifdef TESTING
|
||||
var/tmp/running_find_references
|
||||
var/tmp/last_find_references = 0
|
||||
#endif
|
||||
|
||||
// Default implementation of clean-up code.
|
||||
// This should be overridden to remove all references pointing to the object being destroyed.
|
||||
// Return the appropriate QDEL_HINT; in most cases this is QDEL_HINT_QUEUE.
|
||||
/datum/proc/Destroy(force=FALSE)
|
||||
weakref = null // Clear this reference to ensure it's kept for as brief duration as possible.
|
||||
tag = null
|
||||
nanomanager.close_uis(src)
|
||||
return QDEL_HINT_QUEUE
|
||||
@@ -1,10 +1,3 @@
|
||||
/datum
|
||||
var/weakref/weakref
|
||||
|
||||
/datum/Destroy()
|
||||
weakref = null // Clear this reference to ensure it's kept for as brief duration as possible.
|
||||
. = ..()
|
||||
|
||||
//obtain a weak reference to a datum
|
||||
/proc/weakref(datum/D)
|
||||
if(!istype(D))
|
||||
|
||||
Reference in New Issue
Block a user