mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-14 20:22:42 +00:00
gentle qdel refactor for readability adds ref_name and ref_type to weakref improves /proc/weakref initial test corrects weakref GC hint
31 lines
494 B
Plaintext
31 lines
494 B
Plaintext
/weakref
|
|
var/ref
|
|
var/ref_name
|
|
var/ref_type
|
|
|
|
|
|
/weakref/Destroy()
|
|
SHOULD_CALL_PARENT(FALSE)
|
|
return QDEL_HINT_IWILLGC
|
|
|
|
|
|
/weakref/New(datum/thing)
|
|
ref = "\ref[thing]"
|
|
ref_name = "[thing]"
|
|
ref_type = thing.type
|
|
|
|
|
|
/weakref/proc/resolve()
|
|
var/datum/thing = locate(ref)
|
|
if (thing && thing.weakref == src)
|
|
return thing
|
|
return null
|
|
|
|
|
|
/proc/weakref(datum/thing)
|
|
if (!istype(thing) || QDELING(thing))
|
|
return
|
|
if (!thing.weakref)
|
|
thing.weakref = new /weakref (thing)
|
|
return thing.weakref
|