Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issues with adjusting clothing not updating mob icon. #4646

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions code/game/objects/items/__item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1033,16 +1033,38 @@ modules/mob/living/human/life.dm if you die, you will be zoomed out.
if(item_flags & ITEM_FLAG_IS_BELT)
LAZYADD(., slot_belt_str)

// Where are we usually worn?
var/default_slot = get_fallback_slot()
if(default_slot)
LAZYDISTINCTADD(., default_slot)
// Uniforms can show or hide ID.
if(default_slot == slot_w_uniform_str)
LAZYDISTINCTADD(., slot_wear_id_str)

// Currently this proc is used for clothing updates, so we
// need to care what slot we are being worn in, if any.
if(ismob(loc))
var/mob/wearer = loc
var/equipped_slot = wearer.get_equipped_slot_for_item(src)
if(equipped_slot)
LAZYDISTINCTADD(., equipped_slot)

// Updates the icons of the mob wearing the clothing item, if any.
/obj/item/proc/update_clothing_icon(do_update_icon = TRUE)
var/mob/wearer = loc
if(!istype(wearer))
return FALSE
var/equip_slots = get_associated_equipment_slots()
if(!islist(equip_slots))

// Accessories should pass this back to their holder.
if(isitem(loc))
var/obj/item/holder = loc
return holder.update_clothing_icon(do_update_icon)

// If we're not on a mob, we do not care.
if(!ismob(loc))
return FALSE
for(var/slot in equip_slots)
wearer.update_equipment_overlay(slot, FALSE)

// We refresh our equipped slot and any associated slots that might depend on the state of this slot.
var/mob/wearer = loc
for(var/equipped_slot in get_associated_equipment_slots())
wearer.update_equipment_overlay(equipped_slot, FALSE)
if(do_update_icon)
wearer.update_icon()
return TRUE
Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/items/weapons/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
material = /decl/material/solid/organic/leather/synth
var/overlay_flags

/obj/item/belt/get_associated_equipment_slots()
. = ..()
LAZYDISTINCTADD(., slot_belt_str)

/obj/item/belt/verb/toggle_layer()
set name = "Switch Belt Layer"
set category = "Object"
Expand Down
5 changes: 0 additions & 5 deletions code/modules/clothing/costumes/_costume.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@
w_class = ITEM_SIZE_NORMAL
fallback_slot = slot_w_uniform_str
valid_accessory_slots = UNIFORM_DEFAULT_ACCESSORIES

/obj/item/clothing/costume/get_associated_equipment_slots()
. = ..()
var/static/list/under_slots = list(slot_w_uniform_str, slot_wear_id_str)
LAZYDISTINCTADD(., under_slots)
5 changes: 0 additions & 5 deletions code/modules/clothing/dresses/_dress.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@
w_class = ITEM_SIZE_NORMAL
valid_accessory_slots = UNIFORM_DEFAULT_ACCESSORIES
fallback_slot = slot_w_uniform_str

/obj/item/clothing/dress/get_associated_equipment_slots()
. = ..()
var/static/list/under_slots = list(slot_w_uniform_str, slot_wear_id_str)
LAZYDISTINCTADD(., under_slots)
6 changes: 3 additions & 3 deletions code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@

/obj/item/clothing/glasses/update_clothing_icon()
. = ..()
if(.)
var/mob/M = loc
M.update_action_buttons()
if(. && ismob(loc))
var/mob/wearer = loc
wearer.update_action_buttons()

/obj/item/clothing/glasses/proc/toggle()
set category = "Object"
Expand Down
4 changes: 0 additions & 4 deletions code/modules/clothing/gloves/_gloves.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
fallback_slot = slot_gloves_str
var/obj/item/clothing/gloves/ring/covering_ring

/obj/item/clothing/gloves/get_associated_equipment_slots()
. = ..()
LAZYDISTINCTADD(., slot_gloves_str)

/obj/item/clothing/gloves/proc/Touch(var/atom/A, var/proximity)
return

Expand Down
4 changes: 0 additions & 4 deletions code/modules/clothing/head/_head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,3 @@
light_overlay = image(overlay.icon, "[overlay.icon_state]_light")
overlay.overlays += light_overlay
. = ..()

/obj/item/clothing/head/get_associated_equipment_slots()
. = ..()
LAZYDISTINCTADD(., slot_head_str)
5 changes: 0 additions & 5 deletions code/modules/clothing/jumpsuits/_jumpsuit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@
GET_DECL(/decl/clothing_state_modifier/rolled_sleeves)
)
return expected_state_modifiers

/obj/item/clothing/costume/get_associated_equipment_slots()
. = ..()
var/static/list/under_slots = list(slot_w_uniform_str, slot_wear_id_str)
LAZYDISTINCTADD(., under_slots)
4 changes: 0 additions & 4 deletions code/modules/clothing/masks/_mask.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
action_button_name = "Adjust Mask"
verbs += .verb/adjust_mask

/obj/item/clothing/mask/get_associated_equipment_slots()
. = ..()
LAZYDISTINCTADD(., slot_wear_mask_str)

/obj/item/clothing/mask/adjust_mob_overlay(mob/living/user_mob, bodytype, image/overlay, slot, bodypart, use_fallback_if_icon_missing = TRUE)
if(overlay && hanging && slot == slot_wear_mask_str && check_state_in_icon("[overlay.icon_state]-down", overlay.icon))
overlay.icon_state = "[overlay.icon_state]-down"
Expand Down
5 changes: 0 additions & 5 deletions code/modules/clothing/pants/_pants.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@
w_class = ITEM_SIZE_NORMAL
fallback_slot = slot_w_uniform_str
valid_accessory_slots = UNIFORM_DEFAULT_ACCESSORIES

/obj/item/clothing/pants/get_associated_equipment_slots()
. = ..()
var/static/list/pants_slots = list(slot_w_uniform_str, slot_wear_id_str)
LAZYDISTINCTADD(., pants_slots)
5 changes: 0 additions & 5 deletions code/modules/clothing/shirts/_shirts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,3 @@
slot_flags = SLOT_UPPER_BODY
accessory_slot = ACCESSORY_SLOT_DECOR
fallback_slot = slot_w_uniform_str

/obj/item/clothing/shirt/get_associated_equipment_slots()
. = ..()
var/static/list/shirt_slots = list(slot_w_uniform_str, slot_wear_id_str)
LAZYDISTINCTADD(., shirt_slots)
4 changes: 0 additions & 4 deletions code/modules/clothing/shoes/_shoes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@
attached_cuffs = null
return

/obj/item/clothing/shoes/get_associated_equipment_slots()
. = ..()
LAZYDISTINCTADD(., slot_shoes_str)

/obj/item/clothing/shoes/set_material(var/new_material)
..()
if(shine != -1 && material.reflectiveness >= MAT_VALUE_DULL)
Expand Down
5 changes: 0 additions & 5 deletions code/modules/clothing/skirts/_skirt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@
w_class = ITEM_SIZE_NORMAL
valid_accessory_slots = UNIFORM_DEFAULT_ACCESSORIES
fallback_slot = slot_w_uniform_str

/obj/item/clothing/skirt/get_associated_equipment_slots()
. = ..()
var/static/list/under_slots = list(slot_w_uniform_str, slot_wear_id_str)
LAZYDISTINCTADD(., under_slots)
4 changes: 0 additions & 4 deletions code/modules/clothing/suits/_suit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
/obj/item/clothing/suit/gives_weather_protection()
return protects_against_weather

/obj/item/clothing/suit/get_associated_equipment_slots()
. = ..()
LAZYDISTINCTADD(., slot_wear_suit_str)

/obj/item/clothing/suit/preserve_in_cryopod(var/obj/machinery/cryopod/pod)
return TRUE

Expand Down
Loading