From 93fc25782fc6dcb18f4efc181fdb0ab7633bceed Mon Sep 17 00:00:00 2001 From: GDN <96800819+GDNgit@users.noreply.github.com> Date: Fri, 21 Apr 2023 23:53:30 -0500 Subject: [PATCH] makes clingstings GC (#20656) * makes clingstings GC * steels review --- code/_onclick/click_override.dm | 2 +- code/modules/antagonists/changeling/powers/tiny_prick.dm | 2 +- code/modules/mob/living/living.dm | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/_onclick/click_override.dm b/code/_onclick/click_override.dm index f6a923fb1f5..9dad3ad9120 100644 --- a/code/_onclick/click_override.dm +++ b/code/_onclick/click_override.dm @@ -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*/ diff --git a/code/modules/antagonists/changeling/powers/tiny_prick.dm b/code/modules/antagonists/changeling/powers/tiny_prick.dm index 3d92d9e84bd..f32539d192f 100644 --- a/code/modules/antagonists/changeling/powers/tiny_prick.dm +++ b/code/modules/antagonists/changeling/powers/tiny_prick.dm @@ -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) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 479d57d126f..29d044700ca 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -48,6 +48,7 @@ qdel(S) else S.be_replaced() + QDEL_NULL(middleClickOverride) if(mind?.current == src) mind.current = null return ..()