mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-31 00:58:26 +01:00
Stamina indicator HUD for humans (#64011)
imageadd: Added a stamina indicator to the human mob's HUD.
This commit is contained in:
@@ -71,9 +71,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"
|
||||
|
||||
@@ -74,6 +74,7 @@ GLOBAL_LIST_INIT(available_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
|
||||
@@ -131,6 +132,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
|
||||
QDEL_LIST(infodisplay)
|
||||
|
||||
healths = null
|
||||
stamina = null
|
||||
healthdoll = null
|
||||
wanted_lvl = null
|
||||
internals = null
|
||||
|
||||
@@ -291,6 +291,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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -539,7 +539,7 @@
|
||||
REMOVE_TRAIT(src, TRAIT_FLOORED, STAMINA)
|
||||
else
|
||||
return
|
||||
update_health_hud()
|
||||
update_stamina_hud()
|
||||
|
||||
/mob/living/carbon/update_sight()
|
||||
if(!client)
|
||||
@@ -768,6 +768,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]"
|
||||
@@ -809,6 +832,7 @@
|
||||
set_stat(CONSCIOUS)
|
||||
update_damage_hud()
|
||||
update_health_hud()
|
||||
update_stamina_hud()
|
||||
med_hud_set_status()
|
||||
|
||||
|
||||
|
||||
@@ -709,8 +709,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"
|
||||
|
||||
@@ -1107,6 +1107,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 |
Reference in New Issue
Block a user