Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions code/__DEFINES/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@
/// One application of the trait translates to -0.2 "vasodilation", which is a -0.2 multiplier to blood pressure
#define TRAIT_VASODILATED "vasodilated"

/// Attempts to stabilize the heart, boosting it if it's too slow and slowing it if it's too fast.
#define TRAIT_HEART_RATE_STABILIZED "heart_rate_stabilized"

/// The trait that determines if someone has the robotic limb reattachment quirk.
#define TRAIT_ROBOTIC_LIMBATTACHMENT "trait_robotic_limbattachment"

Expand Down Expand Up @@ -210,6 +213,10 @@
#define SLOW_HEARTBEAT_THRESHOLD 60
/// Threshold that heart beat becomes "fast"
#define FAST_HEARTBEAT_THRESHOLD 110
/// Threshold that heart beat starts to cause heart damaage
#define DANGER_HEARTBEAT_THRESHOLD 160
/// Threshold that heart beat's heart damage doubles and it has a chance to stop outright
#define DEADLY_HEARTBEAT_THRESHOLD 200

// Used in living mob offset list for determining pixel offsets
#define PIXEL_W_OFFSET "w"
Expand Down
2 changes: 2 additions & 0 deletions code/_onclick/hud/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,14 @@
infodisplay += spacesuit

healths = new /atom/movable/screen/healths(null, src)
healths.name = "heart rate"
infodisplay += healths

hunger = new /atom/movable/screen/hunger(null, src)
infodisplay += hunger

healthdoll = new /atom/movable/screen/healthdoll/human(null, src)
healthdoll.name = "body status"
infodisplay += healthdoll
/*
stamina = new /atom/movable/screen/stamina(null, src)
Expand Down
8 changes: 8 additions & 0 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,16 @@

/atom/movable/screen/healths
name = "health"
icon = 'maplestation_modules/icons/hud/screen_gen.dmi'
icon_state = "health0"
screen_loc = ui_health
mouse_over_pointer = MOUSE_HAND_POINTER

/atom/movable/screen/healths/Click(location, control, params)
. = ..()
if(ishuman(usr))
var/mob/living/carbon/human/human_user = usr
human_user.check_pulse(human_user)

/atom/movable/screen/healths/alien
icon = 'icons/hud/screen_alien.dmi'
Expand Down
4 changes: 2 additions & 2 deletions code/datums/status_effects/debuffs/screwy_hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
if(other_screwy_hud.priority > priority)
return

source.hud_used.healths.icon_state = override_icon
source.hud_used.healths.icon_state = "[override_icon][source.needs_heart() ? "" : "-alwaysflat"]"
return COMPONENT_OVERRIDE_HEALTH_HUD

/datum/status_effect/grouped/screwy_hud/fake_dead
Expand All @@ -55,7 +55,7 @@
/datum/status_effect/grouped/screwy_hud/fake_healthy
id = "fake_hud_healthy"
priority = 10 // fully healthy is the opposite of death, which is absolute
override_icon = "health0"
override_icon = "health1"

/datum/status_effect/grouped/screwy_hud/fake_healthy/on_apply()
. = ..()
Expand Down
23 changes: 16 additions & 7 deletions code/game/objects/items/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@
if(SEND_SIGNAL(H, COMSIG_DEFIBRILLATOR_PRE_HELP_ZAP, user, src) & COMPONENT_DEFIB_STOP)
do_cancel()
return
var/obj/item/organ/heart = H.get_organ_slot(ORGAN_SLOT_HEART)
var/obj/item/organ/heart/heart = H.get_organ_slot(ORGAN_SLOT_HEART)
if(H.stat == DEAD)
H.visible_message(span_warning("[H]'s body convulses a bit."))
playsound(src, SFX_BODYFALL, 50, TRUE)
Expand Down Expand Up @@ -653,20 +653,29 @@
user.audible_message(span_warning("[req_defib ? "[defib]" : "[src]"] buzzes: Patient's heart is missing. Operation aborted."))
playsound(src, 'sound/machines/defib_failed.ogg', 50, FALSE)

else if(H.undergoing_cardiac_arrest())
else if(!heart.is_beating())
playsound(src, 'sound/machines/defib_zap.ogg', 50, TRUE, -1)
if(!(heart.organ_flags & ORGAN_FAILING))
H.set_heartattack(FALSE)
if(heart.organ_flags & ORGAN_FAILING)
user.audible_message(span_warning("[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed, heart damage detected."))
else
heart.Restart()
H.apply_status_effect(/datum/status_effect/recent_defib)
user.audible_message(span_notice("[req_defib ? "[defib]" : "[src]"] pings: Patient's heart is now beating again."))
H.emote("gasp")
H.Knockdown(8 SECONDS)
H.set_jitter_if_lower(200 SECONDS)
heart?.apply_organ_damage(10, 95, ORGAN_ORGANIC)
heart.apply_organ_damage(10, 95, ORGAN_ORGANIC)
SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK)
do_success()
else
user.audible_message(span_warning("[req_defib ? "[defib]" : "[src]"] buzzes: Resuscitation failed, heart damage detected."))

else if(heart.get_heart_rate() >= 160)
playsound(src, 'sound/machines/defib_zap.ogg', 50, TRUE, -1)
user.audible_message(span_notice("[req_defib ? "[defib]" : "[src]"] pings: Patient's heartbeat stabilized."))
H.emote("gasp")
SEND_SIGNAL(H, COMSIG_LIVING_MINOR_SHOCK)
do_success()
ADD_TRAIT(H, TRAIT_HEART_RATE_STABILIZED, TRAIT_GENERIC)
addtimer(TRAIT_CALLBACK_REMOVE(H, TRAIT_HEART_RATE_STABILIZED, TRAIT_GENERIC), 60 SECONDS)

else
user.visible_message(span_warning("[req_defib ? "[defib]" : "[src]"] buzzes: Patient is not in a valid state. Operation aborted."))
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mob/living/blood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
adjustOxyLoss(1)
if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY)
add_max_consciousness_value(BLOOD_LOSS, CONSCIOUSNESS_MAX * 0.9)
add_consciousness_modifier(BLOOD_LOSS, -10)
adjust_traumatic_shock(0.5 * seconds_per_tick)
if(getOxyLoss() < 100)
adjustOxyLoss(2) // Keep in mind if they're still breathing while bleeding - some of this will be recovered
Expand All @@ -73,7 +72,6 @@
to_chat(src, span_warning("You feel very [word]."))
if(BLOOD_VOLUME_SURVIVE to BLOOD_VOLUME_BAD)
add_max_consciousness_value(BLOOD_LOSS, CONSCIOUSNESS_MAX * 0.6)
add_consciousness_modifier(BLOOD_LOSS, -20)
adjust_traumatic_shock(1 * seconds_per_tick)
if(getOxyLoss() < 150)
adjustOxyLoss(3)
Expand All @@ -84,7 +82,6 @@
to_chat(src, span_warning("You feel extremely [word]."))
if(-INFINITY to BLOOD_VOLUME_SURVIVE)
add_max_consciousness_value(BLOOD_LOSS, CONSCIOUSNESS_MAX * 0.2)
add_consciousness_modifier(BLOOD_LOSS, -50)
adjust_traumatic_shock(3 * seconds_per_tick)
set_eye_blur_if_lower(20 SECONDS)
// Unconscious(10 SECONDS)
Expand Down
41 changes: 33 additions & 8 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -736,23 +736,48 @@
if(SEND_SIGNAL(src, COMSIG_CARBON_UPDATING_HEALTH_HUD) & COMPONENT_OVERRIDE_HEALTH_HUD)
return

hud_used.healths.icon_state = get_health_hud_icon()

/mob/living/carbon/proc/get_health_hud_icon()
if(stat >= SOFT_CRIT)
hud_used.healths.icon_state = "health6"
return
return "health6"

switch(100 - crit_percent())
if(95 to INFINITY)
hud_used.healths.icon_state = "health0"
return "health0"
if(80 to 95)
hud_used.healths.icon_state = "health1"
return "health1"
if(60 to 80)
hud_used.healths.icon_state = "health2"
return "health2"
if(40 to 60)
hud_used.healths.icon_state = "health3"
return "health3"
if(20 to 40)
hud_used.healths.icon_state = "health4"
return "health4"
else
hud_used.healths.icon_state = "health5"
return "health5"

/mob/living/carbon/human/get_health_hud_icon()
switch(get_bpm())
if(0) // not beating or no heart
if(!needs_heart())
return "[..()]-alwaysflat"

return "health6"

if(70 to 90) // standard
return "health1"

if(60 to 70, 90 to 120) // elevated
return "health2"

if(50 to 60, 120 to 160) // high
return "health3"

if(30 to 50, 160 to DANGER_HEARTBEAT_THRESHOLD) // very high
return "health4"

if(10 to 30, DANGER_HEARTBEAT_THRESHOLD to INFINITY) // critical
return "health5"

/// Upsed specifically to update the spacesuit hud element
/mob/living/carbon/proc/update_spacesuit_hud_icon(cell_state = "empty")
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/carbon/human/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift)
if(most_toxic)
return "[LOWER_TEXT(most_toxic.name)] poisoning"

if("heart_attack")
if(/datum/status_effect/cardiac_arrest::id)
return "cardiac arrest"

if("drunk")
Expand All @@ -123,7 +123,7 @@ GLOBAL_LIST_EMPTY(dead_players_during_shift)
if(findtext(probable_cause, "addiction"))
return "addiction"

return probable_cause
return replacetext(probable_cause, "_", " ")

/mob/living/carbon/human/proc/reagents_readout()
var/readout = "Blood:"
Expand Down
Loading
Loading