diff --git a/code/__DEFINES/hud_locations.dm b/code/__DEFINES/hud_locations.dm index d14a51d3593..3c907ddf9b5 100644 --- a/code/__DEFINES/hud_locations.dm +++ b/code/__DEFINES/hud_locations.dm @@ -107,6 +107,7 @@ #define ui_healthdoll "EAST-1:28,CENTER-1:15" #define ui_health "EAST-1:28,CENTER:17" #define ui_internal "EAST-1:28,CENTER+1:19" +#define ui_stamina "EAST-1:28,CENTER-2:15" //borgs #define ui_borg_health "EAST-1:28,CENTER-1:15" //borgs have the health display where humans have the pressure damage indicator. diff --git a/code/_onclick/hud/human_hud.dm b/code/_onclick/hud/human_hud.dm index 43ab2c14b69..848fd46b2b9 100644 --- a/code/_onclick/hud/human_hud.dm +++ b/code/_onclick/hud/human_hud.dm @@ -329,6 +329,9 @@ mymob.healths = new /atom/movable/screen/healths() infodisplay += mymob.healths + mymob.staminas = new /atom/movable/screen/healths/stamina() + infodisplay += mymob.staminas + mymob.healthdoll = new() infodisplay += mymob.healthdoll diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index bb041323527..d10e0006fb3 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -562,3 +562,7 @@ /atom/movable/screen/component_button/Click(params) if(parent) parent.component_click(src, params) + +/atom/movable/screen/healths/stamina + icon_state = "stamina_0" + screen_loc = ui_stamina diff --git a/code/modules/mob/living/carbon/carbon_life.dm b/code/modules/mob/living/carbon/carbon_life.dm index ea63a7763df..4f393cbe8ee 100644 --- a/code/modules/mob/living/carbon/carbon_life.dm +++ b/code/modules/mob/living/carbon/carbon_life.dm @@ -253,6 +253,7 @@ if(staminaloss) setStaminaLoss(0, FALSE) SEND_SIGNAL(src, COMSIG_CARBON_STAMINA_REGENERATED) + update_stamina_hud() update_health_hud() // Keep SSD people asleep @@ -285,6 +286,11 @@ else healths.icon_state = "health7" + + +/mob/living/carbon/perceived_stamina() + return staminaloss - shock_reduction() + /mob/living/carbon/update_damage_hud() if(!client) return diff --git a/code/modules/mob/living/carbon/carbon_update_status.dm b/code/modules/mob/living/carbon/carbon_update_status.dm index 6a4713b6741..0fd519126c0 100644 --- a/code/modules/mob/living/carbon/carbon_update_status.dm +++ b/code/modules/mob/living/carbon/carbon_update_status.dm @@ -18,6 +18,7 @@ create_debug_log("woke up, trigger reason: [reason]") update_damage_hud() update_health_hud() + update_stamina_hud() med_hud_set_health() med_hud_set_status() diff --git a/code/modules/mob/living/carbon/human/human_death.dm b/code/modules/mob/living/carbon/human/human_death.dm index 6a0e9f7a0df..fe2c5bd74d7 100644 --- a/code/modules/mob/living/carbon/human/human_death.dm +++ b/code/modules/mob/living/carbon/human/human_death.dm @@ -104,6 +104,7 @@ // We're alive again, so re-build the entire healthdoll healthdoll.cached_healthdoll_overlays.Cut() update_health_hud() + update_stamina_hud() // Update healthdoll if(dna.species) dna.species.update_sight(src) diff --git a/code/modules/mob/living/carbon/human/human_mob.dm b/code/modules/mob/living/carbon/human/human_mob.dm index 59786362d25..d9c0e6b9032 100644 --- a/code/modules/mob/living/carbon/human/human_mob.dm +++ b/code/modules/mob/living/carbon/human/human_mob.dm @@ -1904,7 +1904,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X visible_message("[src] is engulfed in shadows and fades into the darkness.", "A sense of dread washes over you as you suddenly dim dark.") /mob/living/carbon/human/proc/get_perceived_trauma(shock_reduction) - return min(health, maxHealth - getStaminaLoss()) + shock_reduction + return min(health, maxHealth) + shock_reduction /mob/living/carbon/human/WakeUp(updating = TRUE) if(dna.species.spec_WakeUp(src)) diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm index 9da5da6e35d..380010d7606 100644 --- a/code/modules/mob/living/damage_procs.dm +++ b/code/modules/mob/living/damage_procs.dm @@ -286,7 +286,7 @@ if(amount > 0) stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier) if(updating) - update_health_hud() + update_stamina_hud() update_stamina() /mob/living/proc/setStaminaLoss(amount, updating = TRUE) @@ -302,7 +302,7 @@ if(amount > 0) stam_regen_start_time = world.time + (STAMINA_REGEN_BLOCK_TIME * stamina_regen_block_modifier) if(updating) - update_health_hud() + update_stamina_hud() update_stamina() /mob/living/proc/getMaxHealth() diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index fac9c031dc9..890b5209345 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -71,6 +71,7 @@ ADD_TRAIT(src, TRAIT_HANDS_BLOCKED, STAT_TRAIT) // immobilized is superfluous as moving when dead ghosts you. update_damage_hud() update_health_hud() + update_stamina_hud() med_hud_set_health() med_hud_set_status() diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 406d4154a65..f824aa6c3d5 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -354,6 +354,7 @@ med_hud_set_health() med_hud_set_status() update_health_hud() + update_stamina_hud() //This proc is used for mobs which are affected by pressure to calculate the amount of pressure that actually diff --git a/code/modules/mob/living/living_life.dm b/code/modules/mob/living/living_life.dm index f930e555c9e..1611a0a09c8 100644 --- a/code/modules/mob/living/living_life.dm +++ b/code/modules/mob/living/living_life.dm @@ -180,3 +180,31 @@ throw_alert("succumb", /atom/movable/screen/alert/succumb) else clear_alert("succumb") + +/mob/living/proc/perceived_stamina() + return staminaloss + +/mob/living/update_stamina_hud() + if(!client || !staminas) + return + + var/perceived_stamina = perceived_stamina() + + switch(perceived_stamina) + if(100 to INFINITY) + staminas.icon_state = "stamina6" + if(80 to 100) + staminas.icon_state = "stamina5" + if(60 to 80) + staminas.icon_state = "stamina4" + if(40 to 60) + staminas.icon_state = "stamina3" + if(20 to 40) + staminas.icon_state = "stamina2" + if(1 to 20) + staminas.icon_state = "stamina1" + else + staminas.icon_state = null +/* else // The 100% stamina is currently disabled, to reduce clutter on your screen + staminas.icon_state = "stamina0" + */ diff --git a/code/modules/mob/mob_update_status_base.dm b/code/modules/mob/mob_update_status_base.dm index 292849c967c..5aff72bd0be 100644 --- a/code/modules/mob/mob_update_status_base.dm +++ b/code/modules/mob/mob_update_status_base.dm @@ -60,3 +60,6 @@ /mob/proc/update_health_hud() return + +/mob/proc/update_stamina_hud() + return diff --git a/code/modules/mob/mob_vars.dm b/code/modules/mob/mob_vars.dm index aa3f1f71098..0a236789e63 100644 --- a/code/modules/mob/mob_vars.dm +++ b/code/modules/mob/mob_vars.dm @@ -18,6 +18,7 @@ var/atom/movable/screen/m_select = null var/atom/movable/screen/healths = null var/atom/movable/screen/throw_icon = null + var/atom/movable/screen/staminas = null /*A bunch of this stuff really needs to go under their own defines instead of being globally attached to mob. A variable should only be globally attached to turfs/objects/whatever, when it is in fact needed as such. diff --git a/code/modules/reagents/chemistry/reagents_holder.dm b/code/modules/reagents/chemistry/reagents_holder.dm index 4d68ff36daa..413b54262be 100644 --- a/code/modules/reagents/chemistry/reagents_holder.dm +++ b/code/modules/reagents/chemistry/reagents_holder.dm @@ -390,7 +390,7 @@ M.update_stat("reagent metabolism") if(update_flags & STATUS_UPDATE_STAMINA) M.update_stamina() - M.update_health_hud() + M.update_stamina_hud() if(update_flags & STATUS_UPDATE_BLIND) M.update_blind_effects() if(update_flags & STATUS_UPDATE_NEARSIGHTED) diff --git a/icons/mob/screen_gen.dmi b/icons/mob/screen_gen.dmi index 59266fafc99..91516af7599 100644 Binary files a/icons/mob/screen_gen.dmi and b/icons/mob/screen_gen.dmi differ