From dcc063700fb242587d73750fe07665bb71c661bc Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 24 Sep 2020 20:34:00 +0200 Subject: [PATCH] [MIRROR] Clears up issues moods and alerts on gain of NOBREATH (#968) * Clears up issues moods and alerts on gain of NOBREATH (#53908) Fixes up the gain of the NOBREATH trait to clear breath related moods and alerts. Added a godmode fix up for humans also. * Clears up issues moods and alerts on gain of NOBREATH Co-authored-by: NightRed --- .../modules/mob/living/carbon/init_signals.dm | 25 +++++++++++++++++++ code/modules/mob/living/carbon/life.dm | 2 -- code/modules/surgery/organs/lungs.dm | 2 ++ tgstation.dme | 1 + 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 code/modules/mob/living/carbon/init_signals.dm diff --git a/code/modules/mob/living/carbon/init_signals.dm b/code/modules/mob/living/carbon/init_signals.dm new file mode 100644 index 00000000000..75e47d5ba4e --- /dev/null +++ b/code/modules/mob/living/carbon/init_signals.dm @@ -0,0 +1,25 @@ +//Called on /mob/living/carbon/Initialize(), for the carbon mobs to register relevant signals. +/mob/living/carbon/register_init_signals() + . = ..() + + RegisterSignal(src, SIGNAL_ADDTRAIT(TRAIT_NOBREATH), .proc/on_nobreath_trait_gain) + +/** + * On gain of TRAIT_NOBREATH + * + * This will clear all alerts and moods related to breathing. + */ +/mob/living/carbon/proc/on_nobreath_trait_gain(datum/source) + failed_last_breath = FALSE + clear_alert("too_much_oxy") + clear_alert("not_enough_oxy") + clear_alert("too_much_tox") + clear_alert("not_enough_tox") + clear_alert("nitro") + clear_alert("too_much_nitro") + clear_alert("not_enough_nitro") + clear_alert("too_much_co2") + clear_alert("not_enough_co2") + SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria") + SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "smell") + SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "suffocation") diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index bcc4a8d1d76..38aa4e331fc 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -140,8 +140,6 @@ clear_alert("not_enough_oxy") return FALSE if(HAS_TRAIT(src, TRAIT_NOBREATH)) - failed_last_breath = FALSE - clear_alert("not_enough_oxy") return FALSE var/obj/item/organ/lungs = getorganslot(ORGAN_SLOT_LUNGS) diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index 82a8aa0a329..e2ac65498d4 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -76,6 +76,8 @@ /obj/item/organ/lungs/proc/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) if(H.status_flags & GODMODE) + H.failed_last_breath = FALSE //clear oxy issues + H.clear_alert("not_enough_oxy") return if(HAS_TRAIT(H, TRAIT_NOBREATH)) return diff --git a/tgstation.dme b/tgstation.dme index be125417bc9..3e57602d55d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -2253,6 +2253,7 @@ #include "code\modules\mob\living\carbon\death.dm" #include "code\modules\mob\living\carbon\emote.dm" #include "code\modules\mob\living\carbon\examine.dm" +#include "code\modules\mob\living\carbon\init_signals.dm" #include "code\modules\mob\living\carbon\inventory.dm" #include "code\modules\mob\living\carbon\life.dm" #include "code\modules\mob\living\carbon\skillchip.dm"