From 4338095bdf165d60ec45974acdffbc1b4f983a06 Mon Sep 17 00:00:00 2001 From: Lohikar Date: Sun, 20 Aug 2017 06:00:34 -0500 Subject: [PATCH] Fixes #1491 (#3309) --- code/controllers/subsystems/icon_cache.dm | 3 +++ code/modules/clothing/head/misc_special.dm | 20 +++++++++++++------ .../mob/living/carbon/human/inventory.dm | 2 -- code/modules/paperwork/paper.dm | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/code/controllers/subsystems/icon_cache.dm b/code/controllers/subsystems/icon_cache.dm index 5512c2d3c50..427e32ce4dc 100644 --- a/code/controllers/subsystems/icon_cache.dm +++ b/code/controllers/subsystems/icon_cache.dm @@ -53,5 +53,8 @@ var/list/human_undershirt_cache = list() var/list/human_socks_cache = list() + // This is for the kitty ears item. + var/list/kitty_ear_cache = list() + /datum/controller/subsystem/icon_cache/New() NEW_SS_GLOBAL(SSicon_cache) diff --git a/code/modules/clothing/head/misc_special.dm b/code/modules/clothing/head/misc_special.dm index ee2fd970494..21f1fb88e66 100644 --- a/code/modules/clothing/head/misc_special.dm +++ b/code/modules/clothing/head/misc_special.dm @@ -148,13 +148,21 @@ siemens_coefficient = 1.5 item_icons = list() - update_icon(var/mob/living/carbon/human/user) - if(!istype(user)) return - var/icon/ears = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "kitty") - ears.Blend(rgb(user.r_hair, user.g_hair, user.b_hair), ICON_ADD) +/obj/item/clothing/head/kitty/equipped(mob/living/carbon/human/user, slot) + . = ..() + if (slot == slot_head && istype(user)) + var/hairgb = rgb(user.r_hair, user.g_hair, user.b_hair) + var/icon/blended = SSicon_cache.kitty_ear_cache[hairgb] + if (!blended) + blended = icon('icons/mob/head.dmi', "kitty") + blended.Blend(hairgb, ICON_ADD) + blended.Blend(icon('icons/mob/head.dmi', "kittyinner"), ICON_OVERLAY) - var/icon/earbit = new/icon("icon" = 'icons/mob/head.dmi', "icon_state" = "kittyinner") - ears.Blend(earbit, ICON_OVERLAY) + SSicon_cache.kitty_ear_cache[hairgb] = blended + + icon_override = blended + else if (icon_override) + icon_override = null /obj/item/clothing/head/richard name = "chicken mask" diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 9891dd38bb1..4b52674557a 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -258,8 +258,6 @@ This saves us from having to call add_fingerprint() any time something is put in update_hair(redraw_mob) //rebuild hair update_inv_ears(0) update_inv_wear_mask(0) - if(istype(W,/obj/item/clothing/head/kitty)) - W.update_icon(src) W.equipped(src, slot) update_inv_head(redraw_mob) if(slot_shoes) diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index d2aba2d4309..f4e8a5f901a 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -145,7 +145,7 @@ return if (user.a_intent == I_HELP && old_name && icon_state == "paper_plane") - user.visible_message(span("notice", "the [src] unfolds \the [src]."), span("notice", "You unfold \the [src]."), "You hear paper rustling.") + user.visible_message(span("notice", "\The [user] unfolds \the [src]."), span("notice", "You unfold \the [src]."), "You hear paper rustling.") icon_state = initial(icon_state) throw_range = initial(throw_range) name = old_name