diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 04008d6779f..8a64270dbfa 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -396,8 +396,10 @@ #define MOUSE_OPACITY_OPAQUE 2 // Defib stats -#define DEFIB_TIME_LIMIT 300 -#define DEFIB_TIME_LOSS 60 +/// Past this much time the patient is unrecoverable (in deciseconds). +#define DEFIB_TIME_LIMIT 300 SECONDS +/// Brain damage starts setting in on the patient after some time left rotting. +#define DEFIB_TIME_LOSS 60 SECONDS //different types of atom colorations #define ADMIN_COLOUR_PRIORITY 1 //only used by rare effects like greentext coloring mobs and when admins varedit color diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index e21d2ed5b43..c79ca11bfab 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -70,13 +70,21 @@ //HELPERS -//called when a carbon changes virus -/mob/living/carbon/proc/check_virus() +/// Whether the carbon mob is currently in crit. +/mob/living/carbon/proc/is_in_crit() + for(var/thing in viruses) + var/datum/disease/D = thing + if(istype(D, /datum/disease/critical)) + return TRUE + return FALSE + +/// Whether a virus worthy displaying on the HUD is present. +/mob/living/carbon/proc/has_virus() for(var/thing in viruses) var/datum/disease/D = thing if((!(D.visibility_flags & HIDDEN_SCANNER)) && (D.severity != NONTHREAT)) - return 1 - return 0 + return TRUE + return FALSE //helper for getting the appropriate health status /proc/RoundHealth(mob/living/M) @@ -162,19 +170,22 @@ /mob/living/carbon/med_hud_set_status() var/image/holder = hud_list[STATUS_HUD] var/mob/living/simple_animal/borer/B = has_brain_worms() - if(stat == DEAD || (status_flags & FAKEDEATH)) - if(timeofdeath) - var/tdelta = round(world.time - timeofdeath) - if(tdelta < (DEFIB_TIME_LIMIT * 10)) - holder.icon_state = "huddefib" - return - holder.icon_state = "huddead" + var/dead = stat == DEAD || (status_flags & FAKEDEATH) + // To the right of health bar + if(dead) + var/revivable = timeofdeath && (round(world.time - timeofdeath) < DEFIB_TIME_LIMIT) + if(revivable) + holder.icon_state = "hudflatline" + else + holder.icon_state = "huddead" else if(status_flags & XENO_HOST) holder.icon_state = "hudxeno" - else if(check_virus()) - holder.icon_state = "hudill" else if(B && B.controlling) holder.icon_state = "hudbrainworm" + else if(is_in_crit()) + holder.icon_state = "huddefib" + else if(has_virus()) + holder.icon_state = "hudill" else holder.icon_state = "hudhealthy" diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index df2c5439b29..d9e0958d0bb 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -218,6 +218,8 @@ var/datum/disease/D = thing if(D.visibility_flags & HIDDEN_SCANNER || D.visibility_flags & HIDDEN_PANDEMIC) continue + if(istype(D, /datum/disease/critical)) + continue found_disease = TRUE break occupantData["hasVirus"] = found_disease diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 43697ac4776..a41d6a8b51b 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -168,7 +168,7 @@ REAGENT SCANNER if(H.timeofdeath && (H.stat == DEAD || (H.status_flags & FAKEDEATH))) to_chat(user, "Time of Death: [station_time_timestamp("hh:mm:ss", H.timeofdeath)]") var/tdelta = round(world.time - H.timeofdeath) - if(tdelta < (DEFIB_TIME_LIMIT * 10)) + if(tdelta < DEFIB_TIME_LIMIT) to_chat(user, "Subject died [DisplayTimeText(tdelta)] ago, defibrillation may be possible!") if(mode == 1) @@ -190,12 +190,17 @@ REAGENT SCANNER chemscan(user, H) for(var/thing in H.viruses) var/datum/disease/D = thing - if(!(D.visibility_flags & HIDDEN_SCANNER)) - to_chat(user, "Warning: [D.form] detected\nName: [D.name].\nType: [D.spread_text].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure_text]") + if(D.visibility_flags & HIDDEN_SCANNER) + continue + // Snowflaking heart problems, because they are special (and common). + if(istype(D, /datum/disease/critical)) + to_chat(user, "Warning: Subject is undergoing [D.name].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure_text]") + continue + to_chat(user, "Warning: [D.form] detected\nName: [D.name].\nType: [D.spread_text].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure_text]") if(H.undergoing_cardiac_arrest()) var/obj/item/organ/internal/heart/heart = H.get_int_organ(/obj/item/organ/internal/heart) if(heart && !(heart.status & ORGAN_DEAD)) - to_chat(user, "Warning: Medical Emergency detected\nName: Cardiac Arrest.\nType: The patient's heart has stopped.\nStage: 1/1.\nPossible Cure: Electric Shock") + to_chat(user, "The patient's heart has stopped.\nPossible Cure: Electric Shock") else if(heart && (heart.status & ORGAN_DEAD)) to_chat(user, "Subject's heart is necrotic.") else if(!heart) diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm index 76eaa3111a5..2aecdf536ec 100644 --- a/code/game/objects/items/weapons/defib.dm +++ b/code/game/objects/items/weapons/defib.dm @@ -370,8 +370,8 @@ QDEL_NULL(ghost) var/tplus = world.time - H.timeofdeath - var/tlimit = DEFIB_TIME_LIMIT * 10 //past this much time the patient is unrecoverable (in deciseconds) - var/tloss = DEFIB_TIME_LOSS * 10 //brain damage starts setting in on the patient after some time left rotting + var/tlimit = DEFIB_TIME_LIMIT + var/tloss = DEFIB_TIME_LOSS var/total_burn = 0 var/total_brute = 0 if(do_after(user, 20 * toolspeed, target = M)) //placed on chest and short delay to shock for dramatic effect, revive time is 5sec total diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 09cc812eae3..5bdc34cc728 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -53,6 +53,10 @@ ..() stat = DEAD + + timeofdeath = world.time + create_log(ATTACK_LOG, "died[gibbed ? " (Gibbed)": ""]") + SetDizzy(0) SetJitter(0) SetLoseBreath(0) @@ -72,7 +76,7 @@ med_hud_set_health() med_hud_set_status() if(!gibbed && !QDELETED(src)) - addtimer(CALLBACK(src, .proc/med_hud_set_status), (DEFIB_TIME_LIMIT * 10) + 1) + addtimer(CALLBACK(src, .proc/med_hud_set_status), DEFIB_TIME_LIMIT + 1) for(var/s in ownedSoullinks) var/datum/soullink/S = s @@ -84,9 +88,6 @@ if(!gibbed) update_canmove() - timeofdeath = world.time - create_log(ATTACK_LOG, "died[gibbed ? " (Gibbed)": ""]") - GLOB.alive_mob_list -= src GLOB.dead_mob_list += src if(mind) diff --git a/icons/mob/hud.dmi b/icons/mob/hud.dmi index eb62ce81380..712a05e87df 100644 Binary files a/icons/mob/hud.dmi and b/icons/mob/hud.dmi differ