U_I Phase 2.7: Helmet lights, washing blood more

This commit is contained in:
Arokha Sieyes
2018-03-08 19:09:42 -05:00
parent 2970b37fa1
commit 8eb4442943
8 changed files with 55 additions and 22 deletions

View File

@@ -393,17 +393,17 @@
if(on)
// Generate object icon.
if(!light_overlay_cache["[light_overlay]_icon"])
light_overlay_cache["[light_overlay]_icon"] = image("icon" = 'icons/obj/light_overlays.dmi', "icon_state" = "[light_overlay]")
light_overlay_cache["[light_overlay]_icon"] = image(icon = 'icons/obj/light_overlays.dmi', icon_state = "[light_overlay]")
helmet_light = light_overlay_cache["[light_overlay]_icon"]
add_overlay(helmet_light)
// Generate and cache the on-mob icon, which is used in update_inv_head().
var/cache_key = "[light_overlay][H ? "_[H.species.get_bodytype(H)]" : ""]"
var/body_type = (H && H.species.get_bodytype(H))
var/cache_key = "[light_overlay][body_type && sprite_sheets[body_type] ? "_[body_type]" : ""]"
if(!light_overlay_cache[cache_key])
var/use_icon = 'icons/mob/light_overlays.dmi'
if(H && sprite_sheets[H.species.get_bodytype(H)])
use_icon = sprite_sheets[H.species.get_bodytype(H)]
light_overlay_cache[cache_key] = image("icon" = use_icon, "icon_state" = "[light_overlay]")
var/use_icon = LAZYACCESS(sprite_sheets,body_type) || 'icons/mob/light_overlays.dmi'
light_overlay_cache[cache_key] = image(icon = use_icon, icon_state = "[light_overlay]")
else if(helmet_light)
cut_overlay(helmet_light)
helmet_light = null

View File

@@ -19,8 +19,8 @@
//HELMET: May have a lighting overlay
/obj/item/clothing/head/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0)
var/image/standing = ..()
if(on)
var/cache_key = "[light_overlay]_[body_type]"
if(on && slot_name == slot_head_str)
var/cache_key = "[light_overlay][LAZYACCESS(sprite_sheets,body_type) ? "_[body_type]" : ""]"
if(standing && light_overlay_cache[cache_key])
standing.add_overlay(light_overlay_cache[cache_key])
return standing

View File

@@ -339,7 +339,6 @@
piece.item_flags &= ~(STOPPRESSUREDAMAGE|AIRTIGHT)
else
piece.item_flags |= (STOPPRESSUREDAMAGE|AIRTIGHT)
update_icon(1)
/obj/item/weapon/rig/ui_action_click()
toggle_cooling(usr)

View File

@@ -1018,30 +1018,27 @@
/mob/living/carbon/human/clean_blood(var/washshoes)
. = ..()
gunshot_residue = null
//Always do hands (or whatever's on our hands)
if(gloves)
if(gloves.clean_blood())
update_inv_gloves()
. = 1
gloves.clean_blood()
update_inv_gloves()
gloves.germ_level = 0
else
if(bloody_hands)
. = 1
bloody_hands = 0
bloody_hands = 0
germ_level = 0
//Sometimes do shoes if asked
//Sometimes do shoes if asked (or feet if no shoes)
if(washshoes && shoes)
if(shoes.clean_blood())
update_inv_shoes()
. = 1
shoes.clean_blood()
update_inv_shoes()
shoes.germ_level = 0
else if(washshoes && (feet_blood_color || LAZYLEN(feet_blood_DNA)))
feet_blood_color = null
LAZYCLEARLIST(feet_blood_DNA)
feet_blood_DNA = null
. = 1
feet_blood_color = null
update_bloodied()

View File

@@ -7,7 +7,44 @@ var/global/list/tail_icon_cache = list() //key is [species.race_key][r_skin][g_s
var/global/list/light_overlay_cache = list() //see make_worn_icon() on helmets
var/global/list/damage_icon_parts = list() //see UpdateDamageIcon()
//Add an entry to overlays, assuming it existsup
////////////////////////////////////////////////////////////////////////////////////////////////
// # Human Icon Updating System
//
// This system takes care of the "icon" for human mobs. Of course humans don't just have a single
// icon+icon_state, but a combination of dozens of little sprites including including the body,
// clothing, equipment, in-universe HUD images, etc.
//
// # Basic Operation
// Whenever you do something that should update the on-mob appearance of a worn or held item, You
// will need to call the relevant update_inv_* proc. All of these are named after the variable they
// update from. They are defined at the /mob level so you don't even need to cast to carbon/human.
//
// The new system leverages SSoverlays to actually add/remove the overlays from mob.overlays
// Since SSoverlays already manages batching updates to reduce apperance churn etc, we don't need
// to worry about that. (In short, you can call add/cut overlay as many times as you want, it will
// only get assigned to the mob once per tick.)
// As a corrolary, this means users of this system do NOT need to tell the system when you're done
// making changes.
//
// There are also these special cases:
// update_icons_body() //Handles updating your mob's icon to reflect their gender/race/complexion etc
// UpdateDamageIcon() //Handles damage overlays for brute/burn damage //(will rename this when I geta round to it) ~Carn
// update_skin() //Handles updating skin for species that have a skin overlay.
// update_bloodied() //Handles adding/clearing the blood overlays for hands & feet. Call when bloodied or cleaned.
// update_underwear() //Handles updating the sprite for underwear.
// update_hair() //Handles updating your hair and eyes overlay
// update_mutations() //Handles updating your appearance for certain mutations. e.g TK head-glows
// update_fire() //Handles overlay from being on fire.
// update_water() //Handles overlay from being submerged.
// update_surgery() //Handles overlays from open external organs.
//
// # History (i.e. I'm used to the old way, what is different?)
// You used to have to call update_icons(FALSE) if you planned to make more changes, and call update_icons(TRUE)
// on the final update. All that is gone, just call update_inv_whatever() and it handles the rest.
//
////////////////////////////////////////////////////////////////////////////////////////////////
//Add an entry to overlays, assuming it exists
/mob/living/carbon/human/proc/apply_layer(cache_index)
if((. = overlays_standing[cache_index]))
add_overlay(.)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 38 KiB