Merge pull request #5037 from VOREStation/aro-updateicons

Rewrite human/update_icons()
This commit is contained in:
Anewbe
2018-03-11 21:03:10 -05:00
committed by GitHub
65 changed files with 1195 additions and 1448 deletions
@@ -96,18 +96,18 @@ var/global/list/image/splatter_cache=list()
S.overlays.Cut()
S.overlays += S.blood_overlay
S.blood_DNA |= blood_DNA.Copy()
perp.update_inv_shoes()
else if (hasfeet)//Or feet
perp.feet_blood_color = basecolor
perp.track_blood = max(amount,perp.track_blood)
if(!perp.feet_blood_DNA)
perp.feet_blood_DNA = list()
LAZYINITLIST(perp.feet_blood_DNA)
perp.feet_blood_DNA |= blood_DNA.Copy()
perp.update_bloodied()
else if (perp.buckled && istype(perp.buckled, /obj/structure/bed/chair/wheelchair))
var/obj/structure/bed/chair/wheelchair/W = perp.buckled
W.bloodiness = 4
perp.update_inv_shoes(1)
amount--
/obj/effect/decal/cleanable/blood/proc/dry()
+117 -1
View File
@@ -84,6 +84,9 @@
var/reach = 1 // Length of tiles it can reach, 1 is adjacent.
var/addblends // Icon overlay for ADD highlights when applicable.
var/icon/default_worn_icon //Default on-mob icon
var/worn_layer //Default on-mob layer
/obj/item/New()
..()
if(embed_chance < 0)
@@ -280,6 +283,7 @@
// note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(var/mob/user, var/slot)
hud_layerise()
user.position_hud_item(src,slot)
if(user.client) user.client.screen |= src
if(user.pulling == src) user.stop_pulling()
return
@@ -678,4 +682,116 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
// My best guess as to why this is here would be that it does so little. Still, keep it under all the procs, for sanity's sake.
/obj/item/device
icon = 'icons/obj/device.dmi'
icon = 'icons/obj/device.dmi'
//Worn icon generation for on-mob sprites
/obj/item/proc/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer)
//Get the required information about the base icon
var/icon/icon2use = get_worn_icon_file(body_type = body_type, slot_name = slot_name, default_icon = default_icon, inhands = inhands)
var/state2use = get_worn_icon_state(slot_name = slot_name)
var/layer2use = get_worn_layer(default_layer = default_layer)
//Snowflakey inhand icons in a specific slot
if(inhands && icon2use == icon_override)
switch(slot_name)
if(slot_r_hand_str)
state2use += "_r"
if(slot_l_hand_str)
state2use += "_l"
// testing("[src] (\ref[src]) - Slot: [slot_name], Inhands: [inhands], Worn Icon:[icon2use], Worn State:[state2use], Worn Layer:[layer2use]")
//Generate the base onmob icon
var/icon/standing_icon = icon(icon = icon2use, icon_state = state2use)
if(!inhands)
apply_custom(standing_icon) //Pre-image overridable proc to customize the thing
apply_addblends(icon2use,standing_icon) //Some items have ICON_ADD blend shaders
var/image/standing = image(standing_icon)
standing.alpha = alpha
standing.color = color
standing.layer = layer2use
//Apply any special features
if(!inhands)
apply_blood(standing) //Some items show blood when bloodied
apply_accessories(standing) //Some items sport accessories like webbing
//Return our icon
return standing
//Returns the icon object that should be used for the worn icon
/obj/item/proc/get_worn_icon_file(var/body_type,var/slot_name,var/default_icon,var/inhands)
//1: icon_override var
if(icon_override)
return icon_override
//2: species-specific sprite sheets (skipped for inhands)
var/sheet = sprite_sheets[body_type]
if(sheet && !inhands)
return sheet
//3: slot-specific sprite sheets
sheet = item_icons[slot_name]
if(sheet)
return sheet
//4: item's default icon
if(default_worn_icon)
return default_worn_icon
//5: provided default_icon
if(default_icon)
return default_icon
//6: give up
return
//Returns the state that should be used for the worn icon
/obj/item/proc/get_worn_icon_state(var/slot_name)
//1: slot-specific sprite sheets
var/state = item_state_slots[slot_name]
if(state)
return state
//2: item_state variable
if(item_state)
return item_state
//3: icon_state variable
if(icon_state)
return icon_state
//Returns the layer that should be used for the worn icon (as a FLOAT_LAYER layer, so negative)
/obj/item/proc/get_worn_layer(var/default_layer = 0)
//1: worn_layer variable
if(!isnull(worn_layer)) //Can be zero, so...
return BODY_LAYER+worn_layer
//2: your default
return BODY_LAYER+default_layer
//Apply the addblend blends onto the icon
/obj/item/proc/apply_addblends(var/source_icon, var/icon/standing_icon)
//If we have addblends, blend them onto the provided icon
if(addblends && standing_icon && source_icon)
var/addblend_icon = icon("icon" = source_icon, "icon_state" = addblends)
standing_icon.Blend(addblend_icon, ICON_ADD)
//STUB
/obj/item/proc/apply_custom(var/icon/standing_icon)
return standing_icon
//STUB
/obj/item/proc/apply_blood(var/image/standing)
return standing
//STUB
/obj/item/proc/apply_accessories(var/image/standing)
return standing
-1
View File
@@ -487,7 +487,6 @@
M.timeofdeath = 0
M.stat = UNCONSCIOUS //Life() can bring them back to consciousness if it needs to.
M.regenerate_icons()
M.failed_last_breath = 0 //So mobs that died of oxyloss don't revive and have perpetual out of breath.
M.reload_fullscreen()
@@ -3,6 +3,7 @@
desc = "An updated, modular intercom that fits over the head. Takes encryption keys"
var/radio_desc = ""
icon_state = "headset"
item_state = null //To remove the radio's state
matter = list(DEFAULT_WALL_MATERIAL = 75)
subspace_transmission = 1
canhear_range = 0 // can't hear headsets from very far away
@@ -63,6 +64,17 @@
return ..(freq, level)
return -1
/obj/item/device/radio/headset/get_worn_icon_state(var/slot_name)
var/append = ""
if(icon_override)
switch(slot_name)
if(slot_l_ear_str)
append = "_l"
if(slot_r_ear_str)
append = "_r"
return "[..()][append]"
/obj/item/device/radio/headset/syndicate
origin_tech = list(TECH_ILLEGAL = 3)
syndie = 1
@@ -89,6 +89,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
var/weldermes = "USER lights NAME with FLAME"
var/ignitermes = "USER lights NAME with FLAME"
var/brand
blood_sprite_state = null //Can't bloody these
/obj/item/clothing/mask/smokable/New()
..()
@@ -20,6 +20,12 @@
var/use_time = 30
sprite_sheets = list("Teshari" = 'icons/mob/species/seromi/handcuffs.dmi')
/obj/item/weapon/handcuffs/get_worn_icon_state(var/slot_name)
if(slot_name == slot_handcuffed_str)
return "handcuff1" //Simple
return ..()
/obj/item/weapon/handcuffs/attack(var/mob/living/carbon/C, var/mob/living/user)
if(!user.IsAdvancedToolUser())
@@ -97,6 +103,13 @@
target.update_inv_handcuffed()
return 1
/obj/item/weapon/handcuffs/equipped(var/mob/living/user,var/slot)
. = ..()
if(slot == slot_handcuffed)
user.drop_r_hand()
user.drop_l_hand()
user.stop_pulling()
var/last_chew = 0
/mob/living/carbon/human/RestrainedClickOn(var/atom/A)
if (A != src) return ..()
@@ -210,6 +223,12 @@ var/last_chew = 0
breakouttime = 30
cuff_sound = 'sound/weapons/towelwipe.ogg' //Is there anything this sound can't do?
/obj/item/weapon/handcuffs/legcuffs/get_worn_icon_state(var/slot_name)
if(slot_name == slot_legcuffed_str)
return "legcuff1"
return ..()
/obj/item/weapon/handcuffs/legcuffs/bola/can_place(var/mob/target, var/mob/user)
if(user) //A ranged legcuff, until proper implementation as items it remains a projectile-only thing.
return 1
@@ -303,3 +322,11 @@ var/last_chew = 0
target.legcuffed = lcuffs
target.update_inv_legcuffed()
return 1
/obj/item/weapon/handcuffs/legcuffs/equipped(var/mob/living/user,var/slot)
. = ..()
if(slot == slot_legcuffed)
if(user.m_intent != "walk")
user.m_intent = "walk"
if(user.hud_used && user.hud_used.move_intent)
user.hud_used.move_intent.icon_state = "walking"
@@ -55,8 +55,8 @@
name = "[src.registered_name]'s ID Card ([src.assignment])"
/obj/item/weapon/card/id/proc/set_id_photo(var/mob/M)
front = getFlatIcon(M, SOUTH, always_use_defdir = 1)
side = getFlatIcon(M, WEST, always_use_defdir = 1)
front = getFlatIcon(M, SOUTH)
side = getFlatIcon(M, WEST)
/mob/proc/set_id_info(var/obj/item/weapon/card/id/id_card)
id_card.age = 0
@@ -112,6 +112,12 @@
usr << "The fingerprint hash on the card is [fingerprint_hash]."
return
/obj/item/weapon/card/id/get_worn_icon_state(var/slot_name)
if(slot_name == slot_wear_id_str)
return "id" //Legacy, just how it is. There's only one sprite.
return ..()
/obj/item/weapon/card/id/initialize()
. = ..()
var/datum/job/J = job_master.GetJob(rank)
@@ -22,6 +22,16 @@
show_above_suit = !show_above_suit
update_icon()
//Some belts have sprites to show icons
/obj/item/weapon/storage/belt/make_worn_icon(var/body_type,var/slot_name,var/inhands,var/default_icon,var/default_layer = 0)
var/image/standing = ..()
if(!inhands && contents.len)
for(var/obj/item/i in contents)
var/i_state = i.item_state
if(!i_state) i_state = i.icon_state
standing.add_overlay(image(icon = INV_BELT_DEF_ICON, icon_state = i_state))
return standing
/obj/item/weapon/storage/update_icon()
if (ismob(src.loc))
var/mob/M = src.loc
@@ -23,7 +23,7 @@
name = "box"
desc = "It's just an ordinary box."
icon_state = "box"
item_state_slots = list(slot_r_hand_str = "syringe_kit", slot_l_hand_str = "syringe_kit")
item_state = "syringe_kit"
var/foldable = /obj/item/stack/material/cardboard // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard
max_w_class = ITEMSIZE_SMALL
max_storage_space = INVENTORY_BOX_SPACE
@@ -354,12 +354,10 @@
//such as when picking up all the items on a tile with one click.
/obj/item/weapon/storage/proc/handle_item_insertion(obj/item/W as obj, prevent_warning = 0)
if(!istype(W)) return 0
if(usr)
usr.remove_from_mob(W)
usr.update_icons() //update our overlays
W.forceMove(src)
W.on_enter_storage(src)
if(usr)
usr.remove_from_mob(W,target = src) //If given a target, handles forceMove()
W.on_enter_storage(src)
if (usr.client && usr.s_active != src)
usr.client.screen -= W
W.dropped(usr)
@@ -377,6 +375,10 @@
src.orient2hud(usr)
if(usr.s_active)
usr.s_active.show_to(usr)
else
W.forceMove(src)
W.on_enter_storage(src)
update_icon()
return 1