Little Weakref Refactor

This commit is contained in:
Heroman3003
2023-06-03 19:21:17 +10:00
committed by CHOMPStation2
parent 515d0e49ba
commit 3d53d2bb62
41 changed files with 295 additions and 172 deletions

View File

@@ -7,7 +7,7 @@
var/desc = null // Ditto.
var/icon_state = null // See above.
var/mob/living/holder = null // The mob that this datum is affecting.
var/weakref/origin = null // A weak reference to whatever caused the modifier to appear. THIS NEEDS TO BE A MOB/LIVING. It's a weakref to not interfere with qdel().
var/datum/weakref/origin = null // A weak reference to whatever caused the modifier to appear. THIS NEEDS TO BE A MOB/LIVING. It's a weakref to not interfere with qdel().
var/expire_at = null // world.time when holder's Life() will remove the datum. If null, it lasts forever or until it gets deleted by something else.
var/on_created_text = null // Text to show to holder upon being created.
var/on_expired_text = null // Text to show to holder when it expires.
@@ -68,9 +68,9 @@
/datum/modifier/New(var/new_holder, var/new_origin)
holder = new_holder
if(new_origin)
origin = weakref(new_origin)
origin = WEAKREF(new_origin)
else // We assume the holder caused the modifier if not told otherwise.
origin = weakref(holder)
origin = WEAKREF(holder)
..()
// Checks if the modifier should be allowed to be applied to the mob before attaching it.