diff --git a/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm b/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm index 9846e974827e..73b10d700247 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm @@ -71,3 +71,6 @@ /// From /obj/effect/alien/resin/special/eggmorph/attack_alien: (mob/living/carbon/xenomorph/M) #define COMSIG_XENO_TAKE_HUGGER_FROM_MORPHER "xeno_take_hugger_from_morpher" + +/// From /mob/living/carbon/xenomorph/proc/handle_crit() +#define COMSIG_XENO_ENTER_CRIT "xeno_entering_critical" diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm index bd01376c9f9d..9326ae78bf9d 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/defender/defender_powers.dm @@ -174,11 +174,13 @@ playsound(get_turf(xeno), 'sound/effects/stonedoor_openclose.ogg', 30, 1) if(!xeno.fortify) - RegisterSignal(owner, COMSIG_MOB_DEATH, PROC_REF(death_check)) + RegisterSignal(owner, COMSIG_XENO_ENTER_CRIT, PROC_REF(unconscious_check)) + RegisterSignal(owner, COMSIG_MOB_DEATH, PROC_REF(unconscious_check)) fortify_switch(xeno, TRUE) if(xeno.selected_ability != src) button.icon_state = "template_active" else + UnregisterSignal(owner, COMSIG_XENO_ENTER_CRIT) UnregisterSignal(owner, COMSIG_MOB_DEATH) fortify_switch(xeno, FALSE) if(xeno.selected_ability != src) @@ -249,9 +251,13 @@ else damagedata["armor"] += frontal_armor -/datum/action/xeno_action/activable/fortify/proc/death_check() +/datum/action/xeno_action/activable/fortify/proc/unconscious_check() SIGNAL_HANDLER + if(QDELETED(owner)) + return + + UnregisterSignal(owner, COMSIG_XENO_ENTER_CRIT) UnregisterSignal(owner, COMSIG_MOB_DEATH) fortify_switch(owner, FALSE) diff --git a/code/modules/mob/living/carbon/xenomorph/life.dm b/code/modules/mob/living/carbon/xenomorph/life.dm index d5ca8a41fa39..bbd59a74d8b5 100644 --- a/code/modules/mob/living/carbon/xenomorph/life.dm +++ b/code/modules/mob/living/carbon/xenomorph/life.dm @@ -506,6 +506,7 @@ Make sure their actual health updates immediately.*/ /mob/living/carbon/xenomorph/proc/handle_crit() if(stat <= CONSCIOUS && !gibbing) set_stat(UNCONSCIOUS) + SEND_SIGNAL(src, COMSIG_XENO_ENTER_CRIT) /mob/living/carbon/xenomorph/set_stat(new_stat) . = ..()