diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index 890494eae4b..916154d5139 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -384,10 +384,11 @@ /datum/symptom/heal/coma/proc/coma(mob/living/M) + if(QDELETED(M) || M.stat == DEAD) + return M.fakedeath("regenerative_coma", !deathgasp) addtimer(CALLBACK(src, PROC_REF(uncoma), M), 300) - /datum/symptom/heal/coma/proc/uncoma(mob/living/M) if(QDELETED(M) || !active_coma) return diff --git a/code/modules/antagonists/changeling/powers/defib_grasp.dm b/code/modules/antagonists/changeling/powers/defib_grasp.dm index c99774df536..20ff3049c8f 100644 --- a/code/modules/antagonists/changeling/powers/defib_grasp.dm +++ b/code/modules/antagonists/changeling/powers/defib_grasp.dm @@ -33,7 +33,6 @@ else changeling.fully_heal(heal_flags) - changeling.cure_fakedeath(CHANGELING_TRAIT) // rips us out of revival stasis (if we're in it) changeling.buckled?.unbuckle_mob(changeling) // get us off of stasis beds please changeling.set_resting(FALSE) changeling.adjust_jitter(20 SECONDS) diff --git a/code/modules/antagonists/changeling/powers/fakedeath.dm b/code/modules/antagonists/changeling/powers/fakedeath.dm index c6fa466cdb1..a4b6b54de3d 100644 --- a/code/modules/antagonists/changeling/powers/fakedeath.dm +++ b/code/modules/antagonists/changeling/powers/fakedeath.dm @@ -9,7 +9,7 @@ ignores_fakedeath = TRUE /// How long it takes for revival to ready upon entering stasis. - /// The changelin can opt to stay in fakedeath for longer, though. + /// The changeling can opt to stay in fakedeath for longer, though. var/fakedeath_duration = 40 SECONDS /// If TRUE, we're ready to revive and can click the button to heal. var/revive_ready = FALSE @@ -21,9 +21,11 @@ INVOKE_ASYNC(src, PROC_REF(revive), user) disable_revive(user) // this should be already called via signal, but just incase something wacky happens + else if(enable_fakedeath(user)) + to_chat(user, span_changeling("We begin our stasis, preparing energy to arise once more.")) + else - to_chat(user, span_notice("We begin our stasis, preparing energy to arise once more.")) - enable_fakedeath(user) + stack_trace("Changeling revive failed to enter fakedeath when it should have been in a valid state to.") return TRUE @@ -34,17 +36,21 @@ changeling.fakedeath(CHANGELING_TRAIT) addtimer(CALLBACK(src, PROC_REF(ready_to_regenerate), changeling), fakedeath_duration, TIMER_UNIQUE) + // Basically, these let the ling exit stasis without giving away their ling-y-ness if revived through other means RegisterSignal(changeling, SIGNAL_REMOVETRAIT(TRAIT_DEATHCOMA), PROC_REF(fakedeath_reset)) + RegisterSignal(changeling, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change)) + return TRUE /// Sets [revive_ready] to FALSE and updates the button icons. +/// Can be called mid-revival if the process is being cancelled /datum/action/changeling/fakedeath/proc/disable_revive(mob/living/changeling) - if(!revive_ready) - return + if(revive_ready) + chemical_cost = 15 + revive_ready = FALSE + build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON) - chemical_cost = 15 - revive_ready = FALSE - build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON) UnregisterSignal(changeling, SIGNAL_REMOVETRAIT(TRAIT_DEATHCOMA)) + UnregisterSignal(changeling, COMSIG_MOB_STATCHANGE) /// Sets [revive_ready] to TRUE and updates the button icons. /datum/action/changeling/fakedeath/proc/enable_revive(mob/living/changeling) @@ -56,7 +62,7 @@ build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON) /// Signal proc to stop the revival process if the changeling exits their stasis early. -/datum/action/changeling/fakedeath/proc/fakedeath_reset(datum/source) +/datum/action/changeling/fakedeath/proc/fakedeath_reset(mob/living/source) SIGNAL_HANDLER if(HAS_TRAIT_FROM(source, TRAIT_DEATHCOMA, CHANGELING_TRAIT)) @@ -64,6 +70,16 @@ disable_revive(source) +/// Signal proc to exit fakedeath early if we're revived from being previously dead +/datum/action/changeling/fakedeath/proc/on_stat_change(mob/living/source, new_stat, old_stat) + SIGNAL_HANDLER + + if(old_stat != DEAD) + return + + source.cure_fakedeath(CHANGELING_TRAIT) + to_chat(source, span_changeling("We exit our stasis early.")) + /datum/action/changeling/fakedeath/proc/revive(mob/living/carbon/user) if(!istype(user)) return @@ -75,7 +91,7 @@ var/flags_to_heal = (HEAL_DAMAGE|HEAL_BODY|HEAL_STATUS|HEAL_CC_STATUS) // but leave out limbs so we can do it specially user.revive(flags_to_heal & ~HEAL_LIMBS) - to_chat(user, span_notice("We have revived ourselves.")) + to_chat(user, span_changeling("We have revived ourselves.")) var/static/list/dont_regenerate = list(BODY_ZONE_HEAD) // headless changelings are funny if(!length(user.get_missing_limbs() - dont_regenerate)) @@ -101,7 +117,7 @@ if(!HAS_TRAIT_FROM(user, TRAIT_DEATHCOMA, CHANGELING_TRAIT)) return - to_chat(user, span_notice("We are ready to revive.")) + to_chat(user, span_changeling("We are ready to revive.")) enable_revive(user) /datum/action/changeling/fakedeath/can_sting(mob/living/user) diff --git a/code/modules/mob/living/status_procs.dm b/code/modules/mob/living/status_procs.dm index 16f0d3d2daa..ee77b5ab634 100644 --- a/code/modules/mob/living/status_procs.dm +++ b/code/modules/mob/living/status_procs.dm @@ -517,12 +517,12 @@ /// Induces fake death on a living mob. /mob/living/proc/fakedeath(source, silent = FALSE) - if(stat == DEAD) - return - if(!silent) - emote("deathgasp") + if(stat != DEAD) + if(!silent) + emote("deathgasp") + tod = station_time_timestamp() + add_traits(list(TRAIT_FAKEDEATH, TRAIT_DEATHCOMA), source) - tod = station_time_timestamp() ///Unignores all slowdowns that lack the IGNORE_NOSLOW flag. /mob/living/proc/unignore_slowdown(source) diff --git a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm index 76e97b5e0b0..f7fc8dcf83a 100644 --- a/code/modules/reagents/chemistry/reagents/toxin_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/toxin_reagents.dm @@ -247,7 +247,7 @@ /datum/reagent/toxin/zombiepowder/on_mob_metabolize(mob/living/holder_mob) . = ..() holder_mob.adjustOxyLoss(0.5*REM, FALSE, required_biotype = affected_biotype, required_respiration_type = affected_respiration_type) - if(data?["method"] & INGEST) + if((data?["method"] & INGEST) && holder_mob.stat != DEAD) holder_mob.fakedeath(type) /datum/reagent/toxin/zombiepowder/on_mob_end_metabolize(mob/living/holder_mob) @@ -274,7 +274,8 @@ if(5 to 8) affected_mob.adjustStaminaLoss(40 * REM * seconds_per_tick, 0) if(9 to INFINITY) - affected_mob.fakedeath(type) + if(affected_mob.stat != DEAD) + affected_mob.fakedeath(type) ..() return TRUE