From a2884cac49a58e871d47368e949dd43be1bb110b Mon Sep 17 00:00:00 2001 From: Gary Lafortune Date: Sat, 16 Sep 2023 16:09:50 -0500 Subject: [PATCH] Fixes a null loc bug with lings' Last Stand spell A classic "the state of the game changes between the function being called and `alert()` finally returning something from the user" scenario. :^) --- code/modules/antagonists/changeling/powers/headcrab.dm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/code/modules/antagonists/changeling/powers/headcrab.dm b/code/modules/antagonists/changeling/powers/headcrab.dm index 33f9ef2f5678..920cad4f34d7 100644 --- a/code/modules/antagonists/changeling/powers/headcrab.dm +++ b/code/modules/antagonists/changeling/powers/headcrab.dm @@ -11,11 +11,13 @@ /datum/action/changeling/headcrab/sting_action(mob/living/user) set waitfor = FALSE + if(tgui_alert(user,"Are we sure we wish to kill ourself and create a headslug?",,list("Yes", "No")) != "Yes") + return + if(QDELETED(user)) // Yogs: Implies maybe that the user was already gibbed or something. Prevents a null mob loc later on + return if(ismob(user.pulledby) && is_changeling(user.pulledby) && user.pulledby.grab_state >= GRAB_NECK) to_chat(user, span_warning("Our abilities are being dampened! We cannot use [src]!")) return - if(tgui_alert(usr,"Are we sure we wish to kill ourself and create a headslug?",,list("Yes", "No")) != "Yes") - return ..() var/datum/mind/M = user.mind var/list/organs = user.getorganszone(BODY_ZONE_HEAD, 1)