New Limb HUD System, from Bay

Manually ports https://github.com/Baystation12/Baystation12/pull/13530, and https://github.com/Baystation12/Baystation12/pull/13561 from bay.
Adjusts the scaling on the coloration, since it seems Bay has different shading than us for species, otherwise some species would be dark, and others would be superbright.
Credit goes to Zuhayr for the code.
This commit is contained in:
Neerti
2016-07-10 06:22:44 -04:00
parent 25c580d470
commit 814f59cf29
11 changed files with 131 additions and 42 deletions

View File

@@ -74,6 +74,7 @@
drop_l_hand()
if(healths)
healths.overlays = null // This is specific to humans but the relevant code is here; shouldn't mess with other mobs.
healths.icon_state = "health6"
timeofdeath = world.time

View File

@@ -1032,37 +1032,38 @@
var/obj/machinery/camera/cam = client.eye
client.screen |= cam.client_huds
if(stat == UNCONSCIOUS && health <= 0)
//Critical damage passage overlay
var/severity = 0
switch(health)
if(-20 to -10) severity = 1
if(-30 to -20) severity = 2
if(-40 to -30) severity = 3
if(-50 to -40) severity = 4
if(-60 to -50) severity = 5
if(-70 to -60) severity = 6
if(-80 to -70) severity = 7
if(-90 to -80) severity = 8
if(-95 to -90) severity = 9
if(-INFINITY to -95) severity = 10
overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity)
else
clear_fullscreen("crit")
//Oxygen damage overlay
if(oxyloss)
if(stat != DEAD)
if(stat == UNCONSCIOUS && health <= 0)
//Critical damage passage overlay
var/severity = 0
switch(oxyloss)
if(10 to 20) severity = 1
if(20 to 25) severity = 2
if(25 to 30) severity = 3
if(30 to 35) severity = 4
if(35 to 40) severity = 5
if(40 to 45) severity = 6
if(45 to INFINITY) severity = 7
overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity)
switch(health)
if(-20 to -10) severity = 1
if(-30 to -20) severity = 2
if(-40 to -30) severity = 3
if(-50 to -40) severity = 4
if(-60 to -50) severity = 5
if(-70 to -60) severity = 6
if(-80 to -70) severity = 7
if(-90 to -80) severity = 8
if(-95 to -90) severity = 9
if(-INFINITY to -95) severity = 10
overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity)
else
clear_fullscreen("oxy")
clear_fullscreen("crit")
//Oxygen damage overlay
if(oxyloss)
var/severity = 0
switch(oxyloss)
if(10 to 20) severity = 1
if(20 to 25) severity = 2
if(25 to 30) severity = 3
if(30 to 35) severity = 4
if(35 to 40) severity = 5
if(40 to 45) severity = 6
if(45 to INFINITY) severity = 7
overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity)
else
clear_fullscreen("oxy")
//Fire and Brute damage overlay (BSSR)
var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
@@ -1138,19 +1139,37 @@
if (analgesic > 100)
healths.icon_state = "health_numb"
else
switch(hal_screwyhud)
if(1) healths.icon_state = "health6"
if(2) healths.icon_state = "health7"
else
//switch(health - halloss)
switch(100 - (!can_feel_pain() ? 0 : traumatic_shock))
if(100 to INFINITY) healths.icon_state = "health0"
if(80 to 100) healths.icon_state = "health1"
if(60 to 80) healths.icon_state = "health2"
if(40 to 60) healths.icon_state = "health3"
if(20 to 40) healths.icon_state = "health4"
if(0 to 20) healths.icon_state = "health5"
else healths.icon_state = "health6"
// Generate a by-limb health display.
healths.icon_state = "blank"
healths.overlays = null
var/no_damage = 1
var/trauma_val = 0 // Used in calculating softcrit/hardcrit indicators.
if(!(species.flags & NO_PAIN))
trauma_val = max(traumatic_shock,halloss)/species.total_health
var/limb_trauma_val = trauma_val*0.3
// Collect and apply the images all at once to avoid appearance churn.
var/list/health_images = list()
for(var/obj/item/organ/external/E in organs)
if(no_damage && (E.brute_dam || E.burn_dam))
no_damage = 0
health_images += E.get_damage_hud_image(limb_trauma_val)
// Apply a fire overlay if we're burning.
if(on_fire)
health_images += image('icons/mob/screen1_health.dmi',"burning")
// Show a general pain/crit indicator if needed.
if(trauma_val)
if(!(species.flags & NO_PAIN))
if(trauma_val > 0.7)
health_images += image('icons/mob/screen1_health.dmi',"softcrit")
if(trauma_val >= 1)
health_images += image('icons/mob/screen1_health.dmi',"hardcrit")
else if(no_damage)
health_images += image('icons/mob/screen1_health.dmi',"fullhealth")
healths.overlays += health_images
if(nutrition_icon)
switch(nutrition)

View File

@@ -108,6 +108,7 @@
// HUD data vars.
var/datum/hud_data/hud
var/hud_type
var/health_hud_intensity = 1 // This modifies how intensely the health hud is colored.
// Body/form vars.
var/list/inherent_verbs // Species-specific verbs.

View File

@@ -14,6 +14,7 @@
mob_size = MOB_SMALL
has_fine_manipulation = 0
show_ssd = null
health_hud_intensity = 2
gibbed_anim = "gibbed-m"
dusted_anim = "dust-m"

View File

@@ -23,6 +23,7 @@ var/datum/species/shapeshifter/promethean/prometheans
flags = NO_SCAN | NO_SLIP | NO_MINOR_CUT
appearance_flags = HAS_SKIN_COLOR | HAS_EYE_COLOR | HAS_HAIR_COLOR | RADIATION_GLOWS
spawn_flags = SPECIES_IS_RESTRICTED
health_hud_intensity = 2
breath_type = null
poison_type = null

View File

@@ -11,6 +11,7 @@
name_language = "Schechi"
min_age = 12
max_age = 45
health_hud_intensity = 3
blood_color = "#D514F7"
flesh_color = "#5F7BB0"

View File

@@ -13,6 +13,7 @@
name_language = null // Use the first-name last-name generator rather than a language scrambler
min_age = 17
max_age = 110
health_hud_intensity = 1.5
spawn_flags = SPECIES_CAN_JOIN
appearance_flags = HAS_HAIR_COLOR | HAS_SKIN_TONE | HAS_LIPS | HAS_UNDERWEAR | HAS_EYE_COLOR
@@ -36,6 +37,7 @@
num_alternate_languages = 2
secondary_langs = list("Sinta'unathi")
name_language = "Sinta'unathi"
health_hud_intensity = 2.5
min_age = 18
max_age = 60
@@ -96,6 +98,7 @@
num_alternate_languages = 2
secondary_langs = list("Siik'tajr")
name_language = "Siik'tajr"
health_hud_intensity = 2.5
min_age = 17
max_age = 80
@@ -151,6 +154,7 @@
num_alternate_languages = 2
secondary_langs = list("Skrellian", "Schechi")
name_language = "Skrellian"
health_hud_intensity = 2
min_age = 19
max_age = 80
@@ -193,6 +197,7 @@
show_ssd = "completely quiescent"
num_alternate_languages = 1
name_language = "Rootspeak"
health_hud_intensity = 2.5
min_age = 1
max_age = 300