mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-29 23:17:28 +01:00
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:
@@ -68,6 +68,8 @@
|
||||
var/stage = 0
|
||||
var/cavity = 0
|
||||
|
||||
// HUD element variable, see organ_icon.dm get_damage_hud_image()
|
||||
var/image/hud_damage_image
|
||||
|
||||
/obj/item/organ/external/Destroy()
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ var/global/list/limb_icon_cache = list()
|
||||
if(owner && owner.gender == MALE)
|
||||
gender = "m"
|
||||
|
||||
icon_cache_key = "[icon_name]_[species ? species.name : "Human"]"
|
||||
world << "ICON: Added species. icon_cache_key is now [icon_cache_key]."
|
||||
|
||||
if(force_icon)
|
||||
mob_icon = new /icon(force_icon, "[icon_name][gendered_icon ? "_[gender]" : ""]")
|
||||
else
|
||||
@@ -134,22 +137,30 @@ var/global/list/limb_icon_cache = list()
|
||||
applying.SetIntensity(0.7)
|
||||
|
||||
else if(status & ORGAN_DEAD)
|
||||
icon_cache_key += "_dead"
|
||||
applying.ColorTone(rgb(10,50,0))
|
||||
applying.SetIntensity(0.7)
|
||||
world << "ICON: Added deadness. icon_cache_key is now [icon_cache_key]."
|
||||
|
||||
if(!isnull(s_tone))
|
||||
if(s_tone >= 0)
|
||||
applying.Blend(rgb(s_tone, s_tone, s_tone), ICON_ADD)
|
||||
else
|
||||
applying.Blend(rgb(-s_tone, -s_tone, -s_tone), ICON_SUBTRACT)
|
||||
icon_cache_key += "_tone_[s_tone]"
|
||||
world << "ICON: Added skin tone. icon_cache_key is now [icon_cache_key]."
|
||||
else if(s_col && s_col.len >= 3)
|
||||
applying.Blend(rgb(s_col[1], s_col[2], s_col[3]), ICON_ADD)
|
||||
icon_cache_key += "_color_[s_col[1]]_[s_col[2]]_[s_col[3]]"
|
||||
world << "ICON: Added skin color. icon_cache_key is now [icon_cache_key]."
|
||||
|
||||
// Translucency.
|
||||
if(nonsolid) applying += rgb(,,,180) // SO INTUITIVE TY BYOND
|
||||
|
||||
return applying
|
||||
|
||||
/obj/item/organ/external/var/icon_cache_key
|
||||
|
||||
// new damage icon system
|
||||
// adjusted to set damage_state to brute/burn code only (without r_name0 as before)
|
||||
/obj/item/organ/external/update_icon()
|
||||
@@ -158,3 +169,49 @@ var/global/list/limb_icon_cache = list()
|
||||
damage_state = n_is
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
// Returns an image for use by the human health dolly HUD element.
|
||||
// If the user has traumatic shock, it will be passed in as a minimum
|
||||
// damage amount to represent the pain of the injuries involved.
|
||||
|
||||
// Global scope, used in code below.
|
||||
var/list/flesh_hud_colours = list("#02BA08","#9ECF19","#DEDE10","#FFAA00","#FF0000","#AA0000","#660000")
|
||||
var/list/robot_hud_colours = list("#CFCFCF","#AFAFAF","#8F8F8F","#6F6F6F","#4F4F4F","#2F2F2F","#000000")
|
||||
|
||||
/obj/item/organ/external/proc/get_damage_hud_image(var/min_dam_state)
|
||||
world << "get_damage_hud_image([min_dam_state]) called."
|
||||
|
||||
// Generate the greyscale base icon and cache it for later.
|
||||
// icon_cache_key is set by any get_icon() calls that are made.
|
||||
// This looks convoluted, but it's this way to avoid icon proc calls.
|
||||
if(!hud_damage_image)
|
||||
var/cache_key = "dambase-[icon_cache_key]"
|
||||
if(!icon_cache_key || !limb_icon_cache[cache_key])
|
||||
limb_icon_cache[cache_key] = icon(get_icon(), null, SOUTH)
|
||||
var/image/temp = image(limb_icon_cache[cache_key])
|
||||
if((robotic < ORGAN_ROBOT) && species)
|
||||
// Calculate the required colour matrix.
|
||||
var/r = 0.30 * species.health_hud_intensity
|
||||
var/g = 0.59 * species.health_hud_intensity
|
||||
var/b = 0.11 * species.health_hud_intensity
|
||||
temp.color = list(r, r, r, g, g, g, b, b, b)
|
||||
else if(model)
|
||||
var/datum/robolimb/R = all_robolimbs[model]
|
||||
if(istype(R))
|
||||
var/r = 0.30 * R.health_hud_intensity
|
||||
var/g = 0.59 * R.health_hud_intensity
|
||||
var/b = 0.11 * R.health_hud_intensity
|
||||
temp.color = list(r, r, r, g, g, g, b, b, b)
|
||||
hud_damage_image = image(null)
|
||||
hud_damage_image.overlays += temp
|
||||
|
||||
// Calculate the required color index.
|
||||
var/dam_state = min(1,((brute_dam+burn_dam)/max_damage))
|
||||
// Apply traumatic shock min damage state.
|
||||
if(!isnull(min_dam_state) && dam_state < min_dam_state)
|
||||
dam_state = min_dam_state
|
||||
// Apply colour and return product.
|
||||
var/list/hud_colours = (robotic < ORGAN_ROBOT) ? flesh_hud_colours : robot_hud_colours
|
||||
hud_damage_image.color = hud_colours[max(1,min(ceil(dam_state*hud_colours.len),hud_colours.len))]
|
||||
return hud_damage_image
|
||||
|
||||
@@ -42,6 +42,7 @@ var/const/standard_monitor_styles = "blank=ipc_blank;\
|
||||
var/list/species_cannot_use = list("Teshari")
|
||||
var/list/monitor_styles //If empty, the model of limbs offers a head compatible with monitors.
|
||||
var/parts = BP_ALL //Defines what parts said brand can replace on a body.
|
||||
var/health_hud_intensity = 1 // Intensity modifier for the health GUI indicator.
|
||||
|
||||
/datum/robolimb/nanotrasen
|
||||
company = "NanoTrasen"
|
||||
|
||||
Reference in New Issue
Block a user