support for items that switch states through update_icon.

This commit is contained in:
Ghommie
2020-03-10 16:55:30 +01:00
parent 97315940fe
commit 2b4b626fac
34 changed files with 82 additions and 59 deletions

View File

@@ -103,7 +103,7 @@
. = ..()
addtimer(CALLBACK(src, .proc/check_on_mob, user), 1) //dropped is called before the item is out of the slot, so we need to check slightly later
/obj/item/clockwork/slab/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clockwork/slab/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(isinhands && item_state && inhand_overlay)
var/mutable_appearance/M = mutable_appearance(icon_file, "slab_[inhand_overlay]")

View File

@@ -425,7 +425,7 @@
return 1
return 0
/obj/item/clothing/suit/hooded/cultrobes/cult_shield/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/clothing/suit/hooded/cultrobes/cult_shield/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands && current_charges)
. += mutable_appearance('icons/effects/cult_effects.dmi', "shield-cult", MOB_LAYER + 0.01)

View File

@@ -333,7 +333,7 @@
add_atom_colour("#[user.eye_color]", FIXED_COLOUR_PRIORITY)
colored_before = TRUE
/obj/item/clothing/glasses/sunglasses/blindfold/white/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/glasses/sunglasses/blindfold/white/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands && ishuman(loc) && !colored_before)
var/mob/living/carbon/human/H = loc

View File

@@ -26,7 +26,7 @@
user.visible_message("<span class='suicide'>\the [src] are forcing [user]'s hands around [user.p_their()] neck! It looks like the gloves are possessed!</span>")
return OXYLOSS
/obj/item/clothing/gloves/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/gloves/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
if(damaged_clothes)

View File

@@ -48,7 +48,7 @@
/obj/item/clothing/head/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/head/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
if(damaged_clothes)

View File

@@ -125,7 +125,7 @@
playsound(src, 'sound/mecha/mechmove03.ogg', 50, TRUE) //Visors don't just come from nothing
update_icon()
/obj/item/clothing/head/hardhat/weldhat/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/clothing/head/hardhat/weldhat/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
. += mutable_appearance('icons/mob/head.dmi', "weldhelmet")

View File

@@ -208,7 +208,7 @@
M.color = hair_color
add_overlay(M)
/obj/item/clothing/head/wig/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/head/wig/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
var/datum/sprite_accessory/S = GLOB.hair_styles_list[hair_style]

View File

@@ -28,7 +28,7 @@
/obj/item/clothing/mask/proc/handle_speech()
/obj/item/clothing/mask/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/mask/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
if(body_parts_covered & HEAD)

View File

@@ -6,7 +6,7 @@
strip_delay = 40
equip_delay_other = 40
/obj/item/clothing/neck/worn_overlays(isinhands = FALSE, icon_flag, style_flags = NONE)
/obj/item/clothing/neck/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
if(body_parts_covered & HEAD)
@@ -192,7 +192,7 @@
tagname = stripped_input(user, "Would you like to change the name on the tag?", "Name your new pet", "Spot", MAX_NAME_LEN)
name = "[initial(name)] - [tagname]"
/obj/item/clothing/neck/petcollar/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/clothing/neck/petcollar/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = ..()
if(hasprimary | hassecondary | hastertiary)
if(!isinhands) //prevents the worn sprites from showing up if you're just holding them

View File

@@ -49,7 +49,7 @@
last_bloodtype = blood_dna[blood_dna[blood_dna.len]]//trust me this works
last_blood_DNA = blood_dna[blood_dna.len]
/obj/item/clothing/shoes/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/shoes/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
var/bloody = FALSE

View File

@@ -793,7 +793,7 @@
var/mob/living/carbon/human/C = loc
C.update_inv_wear_suit()
/obj/item/clothing/suit/space/hardsuit/shielded/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/clothing/suit/space/hardsuit/shielded/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
var/file2use = style_flags & STYLE_ALL_TAURIC ? 'modular_citadel/icons/mob/64x32_effects.dmi' : 'icons/effects/effects.dmi'
@@ -956,7 +956,7 @@
add_overlay(helm_overlay)
/obj/item/clothing/head/helmet/space/hardsuit/lavaknight/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/head/helmet/space/hardsuit/lavaknight/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
var/mutable_appearance/energy_overlay = mutable_appearance(icon_file, "knight_cydonia_overlay", ABOVE_LIGHTING_LAYER)
@@ -993,7 +993,7 @@
add_overlay(suit_overlay)
/obj/item/clothing/suit/space/hardsuit/lavaknight/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/suit/space/hardsuit/lavaknight/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
var/mutable_appearance/energy_overlay = mutable_appearance(icon_file, "knight_cydonia_overlay", ABOVE_LIGHTING_LAYER)

View File

@@ -67,7 +67,7 @@
var/datum/action/A=X
A.UpdateButtonIcon()
/obj/item/clothing/head/helmet/space/plasmaman/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/clothing/head/helmet/space/plasmaman/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands && on)
. += mutable_appearance(icon_file, light_overlay)

View File

@@ -11,7 +11,7 @@
var/suittoggled = FALSE
mutantrace_variation = STYLE_DIGITIGRADE
/obj/item/clothing/suit/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/suit/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
if(damaged_clothes)

View File

@@ -987,7 +987,7 @@
item_color = "winterhood_poly"
item_state = "winterhood_poly"
/obj/item/clothing/head/hooded/winterhood/polychromic/worn_overlays(isinhands, icon_file, style_flags = NONE) //this is where the main magic happens.
/obj/item/clothing/head/hooded/winterhood/polychromic/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) //this is where the main magic happens.
. = ..()
if(suit.hasprimary | suit.hassecondary)
if(!isinhands) //prevents the worn sprites from showing up if you're just holding them
@@ -1000,7 +1000,7 @@
secondary_worn.color = suit.secondary_color
. += secondary_worn
/obj/item/clothing/suit/hooded/wintercoat/polychromic/worn_overlays(isinhands, icon_file, style_flags = NONE) //this is where the main magic happens.
/obj/item/clothing/suit/hooded/wintercoat/polychromic/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) //this is where the main magic happens.
. = ..()
if(hasprimary | hassecondary | hastertiary)
if(!isinhands) //prevents the worn sprites from showing up if you're just holding them

View File

@@ -16,7 +16,7 @@
var/mutable_appearance/accessory_overlay
mutantrace_variation = STYLE_DIGITIGRADE
/obj/item/clothing/under/worn_overlays(isinhands = FALSE, icon_file, style_flags = NONE)
/obj/item/clothing/under/worn_overlays(isinhands = FALSE, icon_file, used_state, style_flags = NONE)
. = list()
if(!isinhands)
if(damaged_clothes)

View File

@@ -27,7 +27,7 @@
can_adjust = FALSE
mutantrace_variation = NONE //Not all clothes are currently digi-compatible (only the shorts are as of time of writing)
/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file, style_flags = NONE) //this is where the main magic happens.
/obj/item/clothing/under/polychromic/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE) //this is where the main magic happens.
. = ..()
if(hasprimary | hassecondary | hastertiary)
if(!isinhands) //prevents the worn sprites from showing up if you're just holding them

View File

@@ -86,7 +86,7 @@
tag_overlay.pixel_y = boxes.len * 3
add_overlay(tag_overlay)
/obj/item/pizzabox/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/pizzabox/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = list()
var/current_offset = 2
if(isinhands)

View File

@@ -117,7 +117,7 @@
glass_overlay.appearance_flags = RESET_COLOR
add_overlay(glass_overlay)
/obj/item/clothing/head/helmet/space/hostile_environment/worn_overlays(isinhands, icon_file, style_flags = NONE)
/obj/item/clothing/head/helmet/space/hostile_environment/worn_overlays(isinhands, icon_file, used_state, style_flags = NONE)
. = ..()
if(!isinhands)
var/mutable_appearance/M = mutable_appearance('icons/mob/head.dmi', "hostile_env_glass")

View File

@@ -593,7 +593,7 @@ generate/load female uniform sprites matching all previously decided variables
//Get the overlays for this item when it's being worn
//eg: ammo counters, primed grenade flashes, etc.
var/list/worn_overlays = worn_overlays(isinhands, file2use, style_flags)
var/list/worn_overlays = worn_overlays(isinhands, file2use, state, style_flags)
if(worn_overlays && worn_overlays.len)
standing.overlays.Add(worn_overlays)