Files
Aurora.3/code/datums/weakref.dm
Lohikar 38a3dc55aa Unify datum definitions (#3991)
Unifies all datum vars into a single file & moves all datum procs that made sense into that same file.
2017-12-23 21:29:17 +02:00

18 lines
375 B
Plaintext

/datum/weakref
var/ref
/datum/weakref/New(datum/D)
ref = SOFTREF(D)
/datum/weakref/Destroy(force = 0)
crash_with("Some fuck is trying to [force ? "force-" : ""]delete a weakref!")
if (!force)
return QDEL_HINT_LETMELIVE // feck off
return ..()
/datum/weakref/proc/resolve()
var/datum/D = locate(ref)
if (!QDELETED(D) && D.weakref == src)
. = D