From f581b2d94dc456ec71d692b8a0571397f0ff1a58 Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Tue, 2 Jan 2018 16:17:39 -0500 Subject: [PATCH] Makes the decal component handle updating inventory icons --- code/datums/components/cleaning.dm | 4 ---- code/datums/components/decal.dm | 4 ++++ code/game/objects/items.dm | 30 ++++++++++++++++++++++++++++++ code/modules/clothing/chameleon.dm | 6 +++++- 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/code/datums/components/cleaning.dm b/code/datums/components/cleaning.dm index cb91d3c513..bab2461947 100644 --- a/code/datums/components/cleaning.dm +++ b/code/datums/components/cleaning.dm @@ -25,16 +25,12 @@ if(cleaned_human.lying) if(cleaned_human.head) cleaned_human.head.SendSignal(COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) - cleaned_human.update_inv_head() if(cleaned_human.wear_suit) cleaned_human.wear_suit.SendSignal(COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) - cleaned_human.update_inv_wear_suit() else if(cleaned_human.w_uniform) cleaned_human.w_uniform.SendSignal(COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) - cleaned_human.update_inv_w_uniform() if(cleaned_human.shoes) cleaned_human.shoes.SendSignal(COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) - cleaned_human.update_inv_shoes() cleaned_human.SendSignal(COMSIG_COMPONENT_CLEAN_ACT, CLEAN_STRENGTH_BLOOD) cleaned_human.wash_cream() to_chat(cleaned_human, "[AM] cleans your face!") diff --git a/code/datums/components/decal.dm b/code/datums/components/decal.dm index 53faa27f39..6378695c24 100644 --- a/code/datums/components/decal.dm +++ b/code/datums/components/decal.dm @@ -41,10 +41,14 @@ /datum/component/decal/proc/apply(atom/thing) var/atom/master = thing || parent master.add_overlay(pic, TRUE) + if(isitem(master)) + addtimer(CALLBACK(master, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE) /datum/component/decal/proc/remove(atom/thing) var/atom/master = thing || parent master.cut_overlay(pic, TRUE) + if(isitem(master)) + addtimer(CALLBACK(master, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE) /datum/component/decal/proc/rotate_react(old_dir, new_dir) if(old_dir == new_dir) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 11edcb11b2..33d055b791 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -594,6 +594,36 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) /obj/item/proc/get_belt_overlay() //Returns the icon used for overlaying the object on a belt return mutable_appearance('icons/obj/clothing/belt_overlays.dmi', icon_state) +/obj/item/proc/update_slot_icon() + if(!ismob(loc)) + return + var/mob/owner = loc + var/flags = slot_flags + if(flags & SLOT_OCLOTHING) + owner.update_inv_wear_suit() + if(flags & SLOT_ICLOTHING) + owner.update_inv_w_uniform() + if(flags & SLOT_GLOVES) + owner.update_inv_gloves() + if(flags & SLOT_EYES) + owner.update_inv_glasses() + if(flags & SLOT_EARS) + owner.update_inv_ears() + if(flags & SLOT_MASK) + owner.update_inv_wear_mask() + if(flags & SLOT_HEAD) + owner.update_inv_head() + if(flags & SLOT_FEET) + owner.update_inv_shoes() + if(flags & SLOT_ID) + owner.update_inv_wear_id() + if(flags & SLOT_BELT) + owner.update_inv_belt() + if(flags & SLOT_BACK) + owner.update_inv_back() + if(flags & SLOT_NECK) + owner.update_inv_neck() + /obj/item/proc/is_hot() return heat diff --git a/code/modules/clothing/chameleon.dm b/code/modules/clothing/chameleon.dm index 42a85efbc6..27ced5d48a 100644 --- a/code/modules/clothing/chameleon.dm +++ b/code/modules/clothing/chameleon.dm @@ -128,7 +128,8 @@ return update_item(picked_item) - update_item_icon() + var/obj/item/thing = target + thing.update_slot_icon() UpdateButtonIcon() /datum/action/item_action/chameleon/change/proc/update_item(obj/item/picked_item) @@ -166,6 +167,7 @@ return random_look(owner) +<<<<<<< HEAD /datum/action/item_action/chameleon/change/proc/update_item_icon() var/obj/item/I = target var/mob/living/M = owner @@ -196,6 +198,8 @@ if(flags_1 & SLOT_NECK) M.update_inv_neck() +======= +>>>>>>> 8309296... makes the decal component handle updating inventory icons (#33967) /obj/item/clothing/under/chameleon //starts off as black name = "black jumpsuit"