fix changeling middle click stings becoming stuck (#25621)

This commit is contained in:
SteelSlayer
2024-05-28 08:12:51 -05:00
committed by GitHub
parent a94a2ea015
commit a8a6697511
2 changed files with 8 additions and 4 deletions
@@ -81,9 +81,9 @@ RESTRICT_TYPE(/datum/antagonist/changeling)
/datum/antagonist/changeling/Destroy()
SSticker.mode.changelings -= owner
chosen_sting = null
QDEL_LIST_CONTENTS(acquired_powers)
STOP_PROCESSING(SSobj, src)
chosen_sting = null
return ..()
/datum/antagonist/changeling/greet()
@@ -12,11 +12,9 @@
click_override = new(CALLBACK(src, PROC_REF(try_to_sting)))
/datum/action/changeling/sting/Destroy(force, ...)
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)
cling.chosen_sting = null
unset_sting()
return ..()
/datum/action/changeling/sting/Trigger(left_click)
@@ -25,6 +23,12 @@
else
unset_sting()
/datum/action/changeling/sting/Remove(mob/remove_from)
. = ..()
// Check that cling exists because in certain scenarios, it may have been deleted in Destroy() first.
if(cling?.chosen_sting == src)
unset_sting()
/datum/action/changeling/sting/proc/set_sting()
var/mob/living/user = owner
to_chat(user, "<span class='warning'>We prepare our sting, use alt+click or middle mouse button on a target to sting them.</span>")