makes clingstings GC (#20656)

* makes clingstings GC

* steels review
This commit is contained in:
GDN
2023-04-21 23:53:30 -05:00
committed by GitHub
parent c50ffd160f
commit 93fc25782f
3 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
/datum/middleClickOverride/proc/onClick(atom/A, mob/living/user)
user.middleClickOverride = null
return 1
return TRUE
/* Note, when making a new click override it is ABSOLUTELY VITAL that you set the source's clickOverride to null at some point if you don't want them to be stuck with it forever.
Calling the super will do this for you automatically, but if you want a click override to NOT clear itself after the first click, you must do it at some other point in the code*/
@@ -11,7 +11,7 @@
click_override = new(CALLBACK(src, PROC_REF(try_to_sting)))
/datum/action/changeling/sting/Destroy(force, ...)
if(cling.owner.current.middleClickOverride == click_override)
if(cling.owner.current && cling.owner.current.middleClickOverride == click_override) // this is a very scuffed way of doing this honestly
cling.owner.current.middleClickOverride = null
QDEL_NULL(click_override)
if(cling.chosen_sting == src)
+1
View File
@@ -48,6 +48,7 @@
qdel(S)
else
S.be_replaced()
QDEL_NULL(middleClickOverride)
if(mind?.current == src)
mind.current = null
return ..()