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
This commit is contained in:
Fikou
2022-04-17 11:53:53 +02:00
committed by GitHub
parent 05e066d0a9
commit bc3dbfb58a
3 changed files with 41 additions and 3 deletions
+4 -3
View File
@@ -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)
@@ -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
+3
View File
@@ -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