[MIRROR] Stamina indicator HUD for humans [MDB IGNORE] (#10730)

* Stamina indicator HUD for humans (#64011)

imageadd: Added a stamina indicator to the human mob's HUD.

* Stamina indicator HUD for humans

Co-authored-by: Jack LeCroy <3073035+jacklecroy@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-01-16 03:27:44 +01:00
committed by GitHub
parent 1b8a7b35b4
commit 711df4f765
8 changed files with 43 additions and 4 deletions

View File

@@ -83,9 +83,10 @@
//Middle right (status indicators)
#define ui_healthdoll "EAST-1:28,CENTER-2:13"
#define ui_health "EAST-1:28,CENTER-1:15"
#define ui_internal "EAST-1:28,CENTER-3:10"
#define ui_internal "EAST-1:28,CENTER+1:17"
#define ui_mood "EAST-1:28,CENTER:17"
#define ui_spacesuit "EAST-1:28,CENTER-4:10"
#define ui_stamina "EAST-1:28,CENTER-3:10"
//Pop-up inventory
#define ui_shoes "WEST+1:8,SOUTH:5"

View File

@@ -97,6 +97,7 @@ GLOBAL_LIST_INIT(available_erp_ui_styles, list(
var/action_buttons_hidden = FALSE
var/atom/movable/screen/healths
var/atom/movable/screen/stamina
var/atom/movable/screen/healthdoll
var/atom/movable/screen/internals
var/atom/movable/screen/wanted/wanted_lvl
@@ -159,6 +160,7 @@ GLOBAL_LIST_INIT(available_erp_ui_styles, list(
QDEL_LIST(infodisplay)
healths = null
stamina = null
healthdoll = null
wanted_lvl = null
internals = null

View File

@@ -371,6 +371,10 @@
healthdoll.hud = src
infodisplay += healthdoll
stamina = new /atom/movable/screen/stamina()
stamina.hud = src
infodisplay += stamina
pull_icon = new /atom/movable/screen/pull()
pull_icon.icon = ui_style
pull_icon.update_appearance()

View File

@@ -754,3 +754,8 @@ INITIALIZE_IMMEDIATE(/atom/movable/screen/splash)
intent_icon.pixel_x = 16 * (i - 1) - 8 * length(streak)
add_overlay(intent_icon)
return ..()
/atom/movable/screen/stamina
name = "stamina"
icon_state = "stamina0"
screen_loc = ui_stamina

View File

@@ -548,7 +548,7 @@
filters -= FILTER_STAMINACRIT
else
return
update_health_hud()
update_stamina_hud()
/mob/living/carbon/update_sight()
if(!client)
@@ -777,6 +777,29 @@
else
hud_used.healths.icon_state = "health7"
/mob/living/carbon/update_stamina_hud(shown_stamina_amount)
if(!client || !hud_used?.stamina)
return
if(stat == DEAD || IsStun() || IsParalyzed() || IsImmobilized() || IsKnockdown() || IsFrozen())
hud_used.stamina.icon_state = "stamina6"
else
if(shown_stamina_amount == null)
shown_stamina_amount = health - getStaminaLoss() - crit_threshold
if(shown_stamina_amount >= health)
hud_used.stamina.icon_state = "stamina0"
else if(shown_stamina_amount > health*0.8)
hud_used.stamina.icon_state = "stamina1"
else if(shown_stamina_amount > health*0.6)
hud_used.stamina.icon_state = "stamina2"
else if(shown_stamina_amount > health*0.4)
hud_used.stamina.icon_state = "stamina3"
else if(shown_stamina_amount > health*0.2)
hud_used.stamina.icon_state = "stamina4"
else if(shown_stamina_amount > 0)
hud_used.stamina.icon_state = "stamina5"
else
hud_used.stamina.icon_state = "stamina6"
/mob/living/carbon/proc/update_internals_hud_icon(internal_state = 0)
if(hud_used?.internals)
hud_used.internals.icon_state = "internal[internal_state]"
@@ -818,6 +841,7 @@
set_stat(CONSCIOUS)
update_damage_hud()
update_health_hud()
update_stamina_hud()
med_hud_set_status()

View File

@@ -750,8 +750,7 @@
return
else
if(hud_used.healths)
var/health_amount = min(health, maxHealth - getStaminaLoss())
if(..(health_amount)) //not dead
if(..()) //not dead
switch(hal_screwyhud)
if(SCREWYHUD_CRIT)
hud_used.healths.icon_state = "health6"

View File

@@ -1129,6 +1129,10 @@
/mob/proc/update_health_hud()
return
/// Changes the stamina HUD based on new information
/mob/proc/update_stamina_hud()
return
///Update the lighting plane and sight of this mob (sends COMSIG_MOB_UPDATE_SIGHT)
/mob/proc/update_sight()
SEND_SIGNAL(src, COMSIG_MOB_UPDATE_SIGHT)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 107 KiB