mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 06:57:42 +01:00
Adds a stamina meter (#24782)
* Finally done * Contra + Qwerty review * I don't think I broke anything :D * Lewc review
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1904,7 +1904,7 @@ Eyes need to have significantly high darksight to shine unless the mob has the X
|
||||
visible_message("<span class='danger'>[src] is engulfed in shadows and fades into the darkness.</span>", "<span class='danger'>A sense of dread washes over you as you suddenly dim dark.</span>")
|
||||
|
||||
/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))
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
*/
|
||||
|
||||
@@ -60,3 +60,6 @@
|
||||
|
||||
/mob/proc/update_health_hud()
|
||||
return
|
||||
|
||||
/mob/proc/update_stamina_hud()
|
||||
return
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user