mirror of
https://github.com/Yawn-Wider/YWPolarisVore.git
synced 2026-08-22 20:47:56 +01:00
Merge pull request #14936 from ItsSelis/selis-weakrefs
Little Weakref Refactor
This commit is contained in:
@@ -88,14 +88,14 @@
|
||||
for(var/mob/living/L in living_mobs(0)) //add everyone on the tile to the do-not-eat list for a while
|
||||
if(!(LAZYFIND(prey_excludes, L))) // Unless they're already on it, just to avoid fuckery.
|
||||
LAZYSET(prey_excludes, L, world.time)
|
||||
addtimer(CALLBACK(src, .proc/removeMobFromPreyExcludes, weakref(L)), 5 MINUTES)
|
||||
addtimer(CALLBACK(src, .proc/removeMobFromPreyExcludes, WEAKREF(L)), 5 MINUTES)
|
||||
else if(istype(O, /obj/item/device/healthanalyzer))
|
||||
var/healthpercent = health/maxHealth*100
|
||||
to_chat(user, "<span class='notice'>[src] seems to be [healthpercent]% healthy.</span>")
|
||||
else
|
||||
..()
|
||||
|
||||
/mob/living/simple_mob/proc/removeMobFromPreyExcludes(weakref/target)
|
||||
/mob/living/simple_mob/proc/removeMobFromPreyExcludes(datum/weakref/target)
|
||||
if(isweakref(target))
|
||||
var/mob/living/L = target.resolve()
|
||||
LAZYREMOVE(prey_excludes, L) // It's fine to remove a null from the list if we couldn't resolve L
|
||||
|
||||
Reference in New Issue
Block a user