From bc3dbfb58af7f9ee4484ab4cd6219bb2542d2cd5 Mon Sep 17 00:00:00 2001 From: Fikou <23585223+Fikou@users.noreply.github.com> Date: Sun, 17 Apr 2022 11:53:53 +0200 Subject: [PATCH] adds a helper for updating one piece of clothing depending on its slot (#66191) you can now run the proc update_clothing to use the slot_flags of an item to properly update a mob's icons this is used by spraycans coloring an item, instead of running regenerate_icons less weighty than regenerate_icons form of updating an item that you dont really know where is. lets us support modsuits worn on stuff that isnt the back in the future --- code/game/objects/items/crayons.dm | 7 ++-- .../living/carbon/human/human_update_icons.dm | 34 +++++++++++++++++++ code/modules/mob/mob_update_icons.dm | 3 ++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index def8e017f40..2adb64c4b79 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -771,12 +771,13 @@ return FALSE target.add_atom_colour(paint_color, WASHABLE_COLOUR_PRIORITY) - if(isliving(target.loc)) + if(isitem(target) && isliving(target.loc)) + var/obj/item/target_item = target var/mob/living/holder = target.loc - if(holder.is_holding(target)) + if(holder.is_holding(target_item)) holder.update_inv_hands() else - holder.regenerate_icons() + holder.update_clothing(target_item.slot_flags) SEND_SIGNAL(target, COMSIG_OBJ_PAINTED, color_is_dark) . = use_charges(user, 2, requires_full = FALSE) reagents.trans_to(target, ., volume_multiplier, transfered_by = user, methods = VAPOR) diff --git a/code/modules/mob/living/carbon/human/human_update_icons.dm b/code/modules/mob/living/carbon/human/human_update_icons.dm index f07c313a37b..d5b419442f9 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -100,6 +100,40 @@ There are several things that need to be remembered: //damage overlays update_damage_overlays() +/mob/living/carbon/human/update_clothing(slot_flags) + if(slot_flags & ITEM_SLOT_BACK) + update_inv_back() + if(slot_flags & ITEM_SLOT_MASK) + update_inv_wear_mask() + if(slot_flags & ITEM_SLOT_NECK) + update_inv_neck() + if(slot_flags & ITEM_SLOT_HANDCUFFED) + update_inv_handcuffed() + if(slot_flags & ITEM_SLOT_LEGCUFFED) + update_inv_legcuffed() + if(slot_flags & ITEM_SLOT_BELT) + update_inv_belt() + if(slot_flags & ITEM_SLOT_ID) + update_inv_wear_id() + if(slot_flags & ITEM_SLOT_EARS) + update_inv_ears() + if(slot_flags & ITEM_SLOT_EYES) + update_inv_glasses() + if(slot_flags & ITEM_SLOT_GLOVES) + update_inv_gloves() + if(slot_flags & ITEM_SLOT_HEAD) + update_inv_head() + if(slot_flags & ITEM_SLOT_FEET) + update_inv_shoes() + if(slot_flags & ITEM_SLOT_OCLOTHING) + update_inv_wear_suit() + if(slot_flags & ITEM_SLOT_ICLOTHING) + update_inv_w_uniform() + if(slot_flags & ITEM_SLOT_SUITSTORE) + update_inv_s_store() + if(slot_flags & ITEM_SLOT_LPOCKET || slot_flags & ITEM_SLOT_RPOCKET) + update_inv_pockets() + /* --------------------------------------- */ //vvvvvv UPDATE_INV PROCS vvvvvv diff --git a/code/modules/mob/mob_update_icons.dm b/code/modules/mob/mob_update_icons.dm index 9fceade1af5..91db373f663 100644 --- a/code/modules/mob/mob_update_icons.dm +++ b/code/modules/mob/mob_update_icons.dm @@ -4,6 +4,9 @@ /mob/proc/regenerate_icons() //TODO: phase this out completely if possible return +/mob/proc/update_clothing(slot_flags) + return + /mob/proc/update_icons() return