From 9514d2279b55ab324a4f525cf7d4eb89200f51dc Mon Sep 17 00:00:00 2001 From: Kapu1178 <75460809+Kapu1178@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:03:25 -0500 Subject: [PATCH] Refactors Obscurity, caches `flags_inv`. Improves equip/unequip code. (#826) * refactors obscurity * security * fix modsuits and other flags_inv changing things * code cleanup * wrong proc --- code/__DEFINES/inventory.dm | 3 + code/_globalvars/bitfields.dm | 17 ++++ .../effects/decals/cleanable/humans.dm | 2 - code/game/objects/items.dm | 38 +++------ code/game/objects/items/cigs_lighters.dm | 8 +- .../abductor/equipment/abduction_gear.dm | 2 +- .../changeling/powers/mutations.dm | 3 - code/modules/clothing/clothing.dm | 11 ++- code/modules/clothing/glasses/_glasses.dm | 2 +- code/modules/clothing/gloves/_gloves.dm | 6 -- code/modules/clothing/head/_head.dm | 6 -- code/modules/clothing/head/helmet.dm | 5 +- code/modules/clothing/masks/_masks.dm | 7 +- code/modules/clothing/shoes/_shoes.dm | 6 -- code/modules/clothing/suits/_suits.dm | 6 -- code/modules/clothing/under/_under.dm | 14 +--- code/modules/hydroponics/grown/flowers.dm | 4 +- code/modules/mob/inventory.dm | 22 +++-- .../mob/living/carbon/carbon_defines.dm | 3 + .../mob/living/carbon/carbon_update_icons.dm | 2 + .../living/carbon/human/human_stripping.dm | 6 +- .../living/carbon/human/human_update_icons.dm | 2 - .../mob/living/carbon/human/inventory.dm | 63 ++++----------- .../mob/living/carbon/human/species.dm | 5 -- code/modules/mob/living/carbon/inventory.dm | 81 ++++++++++++++----- code/modules/mod/mod_activation.dm | 15 ++-- .../projectiles/guns/energy/laser_gatling.dm | 4 +- code/modules/surgery/bodyparts/digitigrade.dm | 2 +- .../bodyparts/species_parts/vox_bodyparts.dm | 4 +- .../organs/external/_external_organs.dm | 12 +-- code/modules/surgery/organs/external/ipc.dm | 8 +- .../modules/surgery/organs/external/snouts.dm | 2 +- .../modules/surgery/organs/external/spines.dm | 2 +- code/modules/surgery/organs/external/tails.dm | 2 +- .../surgery/organs/external/vox_hair.dm | 2 +- code/modules/surgery/organs/external/wings.dm | 6 +- .../modules/clothing/glasses/glasses.dm | 4 +- 37 files changed, 192 insertions(+), 195 deletions(-) diff --git a/code/__DEFINES/inventory.dm b/code/__DEFINES/inventory.dm index aaa3086075d4..5f75afaaf4c7 100644 --- a/code/__DEFINES/inventory.dm +++ b/code/__DEFINES/inventory.dm @@ -87,6 +87,9 @@ ///hides mutant/moth wings, does not apply to functional wings #define HIDEMUTWINGS (1<<13) +/// Every flag that hides a bodypart or organ. +#define BODYPART_HIDE_FLAGS (HIDESNOUT | HIDEMUTWINGS | HIDEHAIR | HIDEFACIALHAIR | HIDEEYES | HIDEJUMPSUIT) + //bitflags for clothing coverage - also used for limbs #define CHEST (1<<0) #define HEAD (1<<1) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index 9c1e12626873..198a1ae1790e 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -423,3 +423,20 @@ DEFINE_BITFIELD(organ_flags, list( "ORGAN_UNREMOVABLE" = ORGAN_UNREMOVABLE, "ORGAN_CUT_AWAY" = ORGAN_CUT_AWAY )) + +DEFINE_BITFIELD(obscured_slots, list( + "HIDE GLOVES" = HIDEGLOVES, + "HIDE SUITSTORAGE" = HIDESUITSTORAGE, + "HIDE JUMPSUIT" = HIDEJUMPSUIT, + "HIDE SHOES" = HIDESHOES, + "HIDE MASK" = HIDEMASK, + "HIDE EARS" = HIDEEARS, + "HIDE EYES" = HIDEEYES, + "HIDE FACE" = HIDEFACE, + "HIDE HAIR" = HIDEHAIR, + "HIDE FACIALHAIR" = HIDEFACIALHAIR, + "HIDE NECK" = HIDENECK, + "HIDE HEADGEAR" = HIDEHEADGEAR, + "HIDE SNOUT" = HIDESNOUT, + "HIDE MUTWINGS" = HIDEMUTWINGS +)) diff --git a/code/game/objects/effects/decals/cleanable/humans.dm b/code/game/objects/effects/decals/cleanable/humans.dm index ef9df606e624..2383a163edbc 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -526,10 +526,8 @@ to_chat(splashed_human, span_alert("You're blinded by a spray of blood!")) if(splashed_human.wear_suit) splashed_human.wear_suit.add_blood_DNA(blood_dna_info) - splashed_human.update_worn_oversuit() //updates mob overlays to show the new blood (no refresh) if(splashed_human.w_uniform) splashed_human.w_uniform.add_blood_DNA(blood_dna_info) - splashed_human.update_worn_undersuit() //updates mob overlays to show the new blood (no refresh) splatter_strength-- if(splatter_strength <= 0) // we used all the puff so we delete it. diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 9f9201300dcd..ecd012f012d0 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -322,6 +322,10 @@ DEFINE_INTERACTABLE(/obj/item) icon_state = icon_state_wielded return ..() +/obj/item/add_blood_DNA(list/dna) + . = ..() + update_slot_icon() + /// Called when an action associated with our item is deleted /obj/item/proc/on_action_deleted(datum/source) SIGNAL_HANDLER @@ -503,6 +507,14 @@ DEFINE_INTERACTABLE(/obj/item) log_admin("[key_name(usr)] has added [picked_affix_name] fantasy affix to [before_name]") message_admins(span_notice("[key_name(usr)] has added [picked_affix_name] fantasy affix to [before_name]")) +/obj/item/vv_edit_var(vname, vval) + . = ..() + if(vname == NAMEOF(src, flags_inv) && iscarbon(loc)) + var/mob/living/carbon/C = loc + var/slot = C.get_slot_by_item(src) + if(slot) + C.update_slots_for_item(src, slot, TRUE) + /obj/item/attack_hand(mob/user, list/modifiers) . = ..() if(.) @@ -996,31 +1008,7 @@ DEFINE_INTERACTABLE(/obj/item) if(!ismob(loc)) return var/mob/owner = loc - var/flags = slot_flags - if(flags & ITEM_SLOT_OCLOTHING) - owner.update_worn_oversuit() - if(flags & ITEM_SLOT_ICLOTHING) - owner.update_worn_undersuit() - if(flags & ITEM_SLOT_GLOVES) - owner.update_worn_gloves() - if(flags & ITEM_SLOT_EYES) - owner.update_worn_glasses() - if(flags & ITEM_SLOT_EARS) - owner.update_worn_ears() - if(flags & ITEM_SLOT_MASK) - owner.update_worn_mask() - if(flags & ITEM_SLOT_HEAD) - owner.update_worn_head() - if(flags & ITEM_SLOT_FEET) - owner.update_worn_shoes() - if(flags & ITEM_SLOT_ID) - owner.update_worn_id() - if(flags & ITEM_SLOT_BELT) - owner.update_worn_belt() - if(flags & ITEM_SLOT_BACK) - owner.update_worn_back() - if(flags & ITEM_SLOT_NECK) - owner.update_worn_neck() + owner.update_clothing(slot_flags | ITEM_SLOT_HANDS) ///Returns the temperature of src. If you want to know if an item is hot use this proc. /obj/item/proc/get_temperature() diff --git a/code/game/objects/items/cigs_lighters.dm b/code/game/objects/items/cigs_lighters.dm index 177c216a3894..c3c747485e69 100644 --- a/code/game/objects/items/cigs_lighters.dm +++ b/code/game/objects/items/cigs_lighters.dm @@ -281,11 +281,9 @@ CIGARETTE PACKETS ARE IN FANCY.DM T.visible_message(flavor_text) START_PROCESSING(SSobj, src) - //can't think of any other way to update the overlays :< - if(ismob(loc)) - var/mob/M = loc - M.update_worn_mask() - M.update_held_items() + if(iscarbon(loc)) + var/mob/living/carbon/C = loc + C.update_slots_for_item(src) AddComponent(/datum/component/smell, INTENSITY_STRONG, SCENT_PLUME, "nicotine", 5) COOLDOWN_START(src, smoke_cooldown, 20 SECONDS) diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index ddd7d6412e28..aec7013ca99a 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -55,7 +55,7 @@ icon_state = "vest_stealth" if(ishuman(loc)) var/mob/living/carbon/human/H = loc - H.update_worn_oversuit() + H.update_slots_for_item(src) update_action_buttons() /obj/item/clothing/suit/armor/abductor/vest/item_action_slot_check(slot, mob/user) diff --git a/code/modules/antagonists/changeling/powers/mutations.dm b/code/modules/antagonists/changeling/powers/mutations.dm index 975575fe6b45..885b42159656 100644 --- a/code/modules/antagonists/changeling/powers/mutations.dm +++ b/code/modules/antagonists/changeling/powers/mutations.dm @@ -93,9 +93,6 @@ H.visible_message(span_warning("[H] casts off [H.p_their()] [suit_name_simple]!"), span_warning("We cast off our [suit_name_simple]."), span_hear("You hear the organic matter ripping and tearing!")) H.temporarilyRemoveItemFromInventory(H.head, TRUE) //The qdel on dropped() takes care of it H.temporarilyRemoveItemFromInventory(H.wear_suit, TRUE) - H.update_worn_oversuit() - H.update_worn_head() - H.update_body_parts() if(blood_on_castoff) H.add_splatter_floor() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 60b4ba4d9fa1..c69e771c0503 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -426,6 +426,7 @@ //This mostly exists so subtypes can call appriopriate update icon calls on the wearer. /obj/item/clothing/proc/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) damaged_clothes = damaged_state + update_slot_icon() /obj/item/clothing/update_overlays() . = ..() @@ -511,7 +512,7 @@ BLIND // can't see anything if(iscarbon(user)) var/mob/living/carbon/C = user - C.head_update(src, forced = 1) + C.update_slots_for_item(src, force_obscurity_update = TRUE) update_action_buttons() return TRUE @@ -527,6 +528,10 @@ BLIND // can't see anything if(visor_vars_to_toggle & VISOR_TINT) tint ^= initial(tint) + if(iscarbon(loc)) + var/mob/living/carbon/C = loc + C.update_slots_for_item(src, force_obscurity_update = TRUE) + /obj/item/clothing/head/helmet/space/plasmaman/visor_toggling() //handles all the actual toggling of flags up = !up SEND_SIGNAL(src, COMSIG_CLOTHING_VISOR_TOGGLE, up) @@ -538,6 +543,10 @@ BLIND // can't see anything if(visor_vars_to_toggle & VISOR_TINT) tint ^= initial(tint) + if(iscarbon(loc)) + var/mob/living/carbon/C = loc + C.update_slots_for_item(src, force_obscurity_update = TRUE) + /obj/item/clothing/proc/can_use(mob/user) if(user && ismob(user)) if(!user.incapacitated()) diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 97ccc120b86b..7fb4e0805842 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -53,7 +53,7 @@ user.update_sight() if(iscarbon(user)) var/mob/living/carbon/carbon_user = user - carbon_user.head_update(src, forced = TRUE) + carbon_user.update_slots_for_item(src, force_obscurity_update = TRUE) //called when thermal glasses are emped. /obj/item/clothing/glasses/proc/thermal_overload() diff --git a/code/modules/clothing/gloves/_gloves.dm b/code/modules/clothing/gloves/_gloves.dm index 83acad3c8c9f..d70fdfbcebb0 100644 --- a/code/modules/clothing/gloves/_gloves.dm +++ b/code/modules/clothing/gloves/_gloves.dm @@ -48,12 +48,6 @@ else . += mutable_appearance('icons/effects/blood.dmi', "bloodyhands") -/obj/item/clothing/gloves/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) - ..() - if(ismob(loc)) - var/mob/M = loc - M.update_worn_gloves() - /obj/item/clothing/gloves/wirecutter_act(mob/living/user, obj/item/I) . = ..() if(!cut_type) diff --git a/code/modules/clothing/head/_head.dm b/code/modules/clothing/head/_head.dm index ab14804e334c..a20e91fb6c79 100644 --- a/code/modules/clothing/head/_head.dm +++ b/code/modules/clothing/head/_head.dm @@ -80,9 +80,3 @@ . += mutable_appearance('icons/effects/64x64.dmi', "helmetblood_large") else . += mutable_appearance('icons/effects/blood.dmi', "helmetblood") - -/obj/item/clothing/head/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) - ..() - if(ismob(loc)) - var/mob/M = loc - M.update_worn_head() diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index fdde8a4ba1eb..cfeda0ebf1ae 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -136,10 +136,9 @@ icon_state = "[initial(icon_state)][up ? "up" : ""]" to_chat(user, span_notice("[up ? alt_toggle_message : toggle_message] \the [src].")) - user.update_worn_head() if(iscarbon(user)) - var/mob/living/carbon/carbon_user = user - carbon_user.head_update(src, forced = TRUE) + var/mob/living/carbon/C = user + C.update_slots_for_item(src, user.get_slot_by_item(src), TRUE) /obj/item/clothing/head/helmet/justice name = "helmet of justice" diff --git a/code/modules/clothing/masks/_masks.dm b/code/modules/clothing/masks/_masks.dm index f0ce78f1bc0b..81606755bfd0 100644 --- a/code/modules/clothing/masks/_masks.dm +++ b/code/modules/clothing/masks/_masks.dm @@ -80,12 +80,6 @@ else . += mutable_appearance('icons/effects/blood.dmi', "maskblood") -/obj/item/clothing/mask/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) - ..() - if(ismob(loc)) - var/mob/M = loc - M.update_worn_mask() - //Proc that moves gas/breath masks out of the way, disabling them and allowing pill/food consumption /obj/item/clothing/mask/proc/adjustmask(mob/living/carbon/user) if(user?.incapacitated()) @@ -116,6 +110,7 @@ return if(user.wear_mask == src) + user.update_slots_for_item(src, ITEM_SLOT_MASK, TRUE) user.wear_mask_update(src, toggle_off = mask_adjusted) if(loc == user) diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm index 2a9be5f6683b..8d86f66a285c 100644 --- a/code/modules/clothing/shoes/_shoes.dm +++ b/code/modules/clothing/shoes/_shoes.dm @@ -111,12 +111,6 @@ restore_offsets(user) . = ..() -/obj/item/clothing/shoes/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) - ..() - if(ismob(loc)) - var/mob/M = loc - M.update_worn_shoes() - /** * adjust_laces adjusts whether our shoes (assuming they can_be_tied) and tied, untied, or knotted * diff --git a/code/modules/clothing/suits/_suits.dm b/code/modules/clothing/suits/_suits.dm index 73c5d25e340a..3bc49e43f32d 100644 --- a/code/modules/clothing/suits/_suits.dm +++ b/code/modules/clothing/suits/_suits.dm @@ -46,12 +46,6 @@ if(A.above_suit) . += U.accessory_overlay -/obj/item/clothing/suit/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) - ..() - if(ismob(loc)) - var/mob/M = loc - M.update_worn_oversuit() - /** * Wrapper proc to apply shielding through AddComponent(). * Called in /obj/item/clothing/Initialize(). diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index 3d09a920add0..3e13303591bc 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -76,9 +76,6 @@ /obj/item/clothing/under/update_clothes_damaged_state(damaged_state = CLOTHING_DAMAGED) ..() - if(ismob(loc)) - var/mob/M = loc - M.update_worn_undersuit() if(damaged_state == CLOTHING_SHREDDED && has_sensor > NO_SENSORS) has_sensor = BROKEN_SENSORS else if(damaged_state == CLOTHING_PRISTINE && has_sensor == BROKEN_SENSORS) @@ -186,8 +183,7 @@ return var/mob/living/carbon/human/holder = loc - holder.update_worn_undersuit() - holder.update_worn_oversuit() + holder.update_slots_for_item(src) holder.fan_hud_set_fandom() /obj/item/clothing/under/proc/remove_accessory(mob/user) @@ -213,11 +209,9 @@ return var/mob/living/carbon/human/holder = loc - holder.update_worn_undersuit() - holder.update_worn_oversuit() + holder.update_slots_for_item(src) holder.fan_hud_set_fandom() - /obj/item/clothing/under/examine(mob/user) . = ..() if(freshly_laundered) @@ -310,10 +304,10 @@ to_chat(usr, span_notice("You adjust the suit to wear it more casually.")) else to_chat(usr, span_notice("You adjust the suit back to normal.")) + if(ishuman(usr)) var/mob/living/carbon/human/H = usr - H.update_worn_undersuit() - H.update_body() + H.update_slots_for_item(src, force_obscurity_update = TRUE) /obj/item/clothing/under/proc/toggle_jumpsuit_adjust() if(adjusted == DIGITIGRADE_STYLE) diff --git a/code/modules/hydroponics/grown/flowers.dm b/code/modules/hydroponics/grown/flowers.dm index 68f4d88d6958..e7840dfec6cc 100644 --- a/code/modules/hydroponics/grown/flowers.dm +++ b/code/modules/hydroponics/grown/flowers.dm @@ -293,10 +293,10 @@ . = ..() if(slot == ITEM_SLOT_MASK) worn_icon_state = "[base_icon_state]_mouth" - user.update_worn_mask() else worn_icon_state = base_icon_state - user.update_worn_head() + + update_slot_icon() // Carbon Rose /obj/item/seeds/carbon_rose diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index a17cfa13fe14..d985c69a0cf2 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -365,18 +365,23 @@ if(hand_index) held_items[hand_index] = null update_held_items() + if(I) if(client) client.screen -= I + I.layer = initial(I.layer) I.plane = initial(I.plane) I.appearance_flags &= ~NO_CLIENT_COLOR + if(!no_move && !(I.item_flags & DROPDEL)) //item may be moved/qdel'd immedietely, don't bother moving it if (isnull(newloc)) I.moveToNullspace() else I.forceMove(newloc) + I.dropped(src, silent) + SEND_SIGNAL(I, COMSIG_ITEM_POST_UNEQUIP, force, newloc, no_move, invdrop, silent) SEND_SIGNAL(src, COMSIG_MOB_UNEQUIPPED_ITEM, I, force, newloc, no_move, invdrop, silent) return TRUE @@ -437,14 +442,21 @@ dropItemToGround(I) drop_all_held_items() +/// Compiles all flags_inv vars of worn items. +/mob/living/carbon/proc/update_obscurity() + PROTECTED_PROC(TRUE) + + obscured_slots = NONE + for(var/obj/item/I in get_all_worn_items()) + obscured_slots |= I.flags_inv + ///Returns a bitfield of covered item slots. -/mob/living/carbon/proc/check_obscured_slots(transparent_protection) +/mob/living/carbon/proc/check_obscured_slots(transparent_protection, input_slots) var/obscured = NONE - var/hidden_slots = NONE + var/hidden_slots = !isnull(input_slots) ? input_slots : src.obscured_slots - for(var/obj/item/I in get_all_worn_items()) //This contains nulls - hidden_slots |= I.flags_inv - if(transparent_protection) + if(transparent_protection) + for(var/obj/item/I in get_all_worn_items()) hidden_slots |= I.transparent_protection if(hidden_slots & HIDENECK) diff --git a/code/modules/mob/living/carbon/carbon_defines.dm b/code/modules/mob/living/carbon/carbon_defines.dm index 43c5d0f89a88..7be2e596f372 100644 --- a/code/modules/mob/living/carbon/carbon_defines.dm +++ b/code/modules/mob/living/carbon/carbon_defines.dm @@ -60,6 +60,9 @@ ///only used by humans. var/obj/item/clothing/ears = null + /// A compilation of all equipped items 'flags_inv' vars. + var/obscured_slots = NONE + /// Carbon var/datum/dna/dna = null ///last mind to control this mob, for blood-based cloning diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index 85f86cb37f26..afcd14840ec1 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -31,6 +31,8 @@ update_suit_storage() if(slot_flags & (ITEM_SLOT_LPOCKET|ITEM_SLOT_RPOCKET)) update_pockets() + if(slot_flags & ITEM_SLOT_HANDS) + update_held_items() //IMPORTANT: Multiple animate() calls do not stack well, so try to do them all at once if you can. diff --git a/code/modules/mob/living/carbon/human/human_stripping.dm b/code/modules/mob/living/carbon/human/human_stripping.dm index bbbbf0835669..b55af1763083 100644 --- a/code/modules/mob/living/carbon/human/human_stripping.dm +++ b/code/modules/mob/living/carbon/human/human_stripping.dm @@ -69,9 +69,9 @@ GLOBAL_LIST_INIT(strippable_human_items, create_strippable_list(list( if (!ismob(source)) return - var/mob/mob_source = source - mob_source.update_worn_undersuit() - mob_source.update_body() + if(iscarbon(source)) + var/mob/living/carbon/carbon_source = source + carbon_source.update_slots_for_item(source) /datum/strippable_item/mob_item_slot/suit key = STRIPPABLE_ITEM_SUIT 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 292c16a9625a..abf28fc2cf80 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -595,7 +595,6 @@ There are several things that need to be remembered: suit_overlay.pixel_x += dna.species.offset_features[OFFSET_SUIT][1] suit_overlay.pixel_y += dna.species.offset_features[OFFSET_SUIT][2] overlays_standing[SUIT_LAYER] = suit_overlay - update_body_parts() apply_overlay(SUIT_LAYER) @@ -674,7 +673,6 @@ There are several things that need to be remembered: overlays_standing[FACEMASK_LAYER] = mask_overlay apply_overlay(FACEMASK_LAYER) - update_body_parts() //Snoots /mob/living/carbon/human/update_worn_back() remove_overlay(BACK_LAYER) diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 715748c2ff37..563db466fc16 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -140,8 +140,7 @@ if(belt) return belt = I - update_worn_belt() - update_name() + update_slots_for_item(I, slot) if(ITEM_SLOT_ID) if(wear_id) @@ -149,21 +148,22 @@ wear_id = I sec_hud_set_ID() - update_name() - update_worn_id() + update_slots_for_item(I, slot) if(ITEM_SLOT_EARS) if(ears) return ears = I - update_worn_ears() + update_slots_for_item(I, slot) if(ITEM_SLOT_EYES) if(glasses) return glasses = I + update_slots_for_item(I, slot) + var/obj/item/clothing/glasses/G = I if(G.glass_colour_type) update_glasses_color(G, 1) @@ -176,44 +176,40 @@ if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view || !isnull(G.lighting_alpha)) update_sight() - update_worn_glasses() if(ITEM_SLOT_GLOVES) if(gloves) return gloves = I - update_worn_gloves() + update_slots_for_item(I, slot) if(ITEM_SLOT_FEET) if(shoes) return shoes = I - update_worn_shoes() + update_slots_for_item(I, slot) if(ITEM_SLOT_OCLOTHING) if(wear_suit) return wear_suit = I - if(I.flags_inv & HIDEJUMPSUIT) - update_worn_undersuit() + update_slots_for_item(I, slot) if(wear_suit.breakouttime) //when equipping a straightjacket ADD_TRAIT(src, TRAIT_RESTRAINED, SUIT_TRAIT) release_all_grabs() //can't pull if restrained update_mob_action_buttons() //certain action buttons will no longer be usable - update_worn_oversuit() - if(ITEM_SLOT_ICLOTHING) if(w_uniform) return w_uniform = I + update_slots_for_item(I, slot) update_suit_sensors() - update_worn_undersuit() if(ITEM_SLOT_LPOCKET) l_store = I @@ -258,11 +254,7 @@ if(index && !QDELETED(src) && dna.species.mutanthands) //hand freed, fill with claws, skip if we're getting deleted. put_in_hand(new dna.species.mutanthands(), index) - if(I == head) - if(!QDELETED(src)) - update_name() - - else if(I == wear_suit) + if(I == wear_suit) if(s_store && invdrop) dropItemToGround(s_store, TRUE) //It makes no sense for your suit storage to stay on you if you drop your suit. @@ -273,9 +265,7 @@ wear_suit = null if(!QDELETED(src)) //no need to update we're getting deleted anyway - if(I.flags_inv & HIDEJUMPSUIT) - update_worn_undersuit() - update_worn_oversuit() + update_slots_for_item(I, ITEM_SLOT_OCLOTHING) else if(I == w_uniform) if(invdrop) @@ -292,12 +282,12 @@ update_suit_sensors() if(!QDELETED(src)) - update_worn_undersuit() + update_slots_for_item(I, ITEM_SLOT_ICLOTHING) else if(I == gloves) gloves = null if(!QDELETED(src)) - update_worn_gloves() + update_slots_for_item(I, ITEM_SLOT_GLOVES) else if(I == glasses) glasses = null @@ -316,24 +306,24 @@ update_sight() if(!QDELETED(src)) - update_worn_glasses() + update_slots_for_item(I, ITEM_SLOT_EYES) else if(I == ears) ears = null if(!QDELETED(src)) - update_worn_ears() + update_slots_for_item(I, ITEM_SLOT_EARS) else if(I == belt) belt = null if(!QDELETED(src)) - update_worn_belt() + update_slots_for_item(I, ITEM_SLOT_BELT) update_name() else if(I == wear_id) wear_id = null sec_hud_set_ID() if(!QDELETED(src)) - update_worn_id() + update_slots_for_item(I, ITEM_SLOT_ID) update_name() else if(I == r_store) @@ -394,8 +384,6 @@ return toggle_internals(tank, TRUE) /mob/living/carbon/human/wear_mask_update(obj/item/I, toggle_off = 1) - if((I.flags_inv & (HIDEHAIR|HIDEFACIALHAIR)) || (initial(I.flags_inv) & (HIDEHAIR|HIDEFACIALHAIR))) - update_body_parts() if(invalid_internals()) cutoff_internals() if(I.flags_inv & HIDEEYES) @@ -404,23 +392,6 @@ update_name() ..() -/mob/living/carbon/human/head_update(obj/item/I, forced) - if((I.flags_inv & (HIDEHAIR|HIDEFACIALHAIR)) || forced) - update_body_parts() - // Close internal air tank if helmet was the only breathing apparatus. - if (invalid_internals()) - cutoff_internals() - - if(I.flags_inv & HIDEEYES || forced) - update_worn_glasses() - - if(I.flags_inv & HIDEEARS || forced) - update_body() - - sec_hud_set_security_status() - update_name() - ..() - /mob/living/carbon/human/proc/equipOutfit(outfit, visualsOnly = FALSE) var/datum/outfit/O = null diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 993bb2054db3..d6e71f40aff4 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1256,15 +1256,12 @@ GLOBAL_LIST_EMPTY(features_by_species) if(bloody) //Apply blood if(H.wear_mask) H.wear_mask.add_mob_blood(H) - H.update_worn_mask() if(H.head) H.head.add_mob_blood(H) - H.update_worn_head() if(H.glasses && prob(33)) H.glasses.add_mob_blood(H) - H.update_worn_glasses() if(BODY_ZONE_CHEST) if(H.stat == CONSCIOUS && !I.sharpness && armor_block < 50) @@ -1276,11 +1273,9 @@ GLOBAL_LIST_EMPTY(features_by_species) if(bloody) if(H.wear_suit) H.wear_suit.add_mob_blood(H) - H.update_worn_oversuit() if(H.w_uniform) H.w_uniform.add_mob_blood(H) - H.update_worn_undersuit() return MOB_ATTACKEDBY_SUCCESS diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index eb495942bbfe..d81d96b92b27 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -88,13 +88,14 @@ if(back) return back = I - update_worn_back() + update_slots_for_item(I, slot) if(ITEM_SLOT_MASK) if(wear_mask) return wear_mask = I + update_slots_for_item(I, slot) wear_mask_update(I, toggle_off = 0) if(ITEM_SLOT_HEAD) @@ -102,14 +103,14 @@ return head = I + update_slots_for_item(I, slot) SEND_SIGNAL(src, COMSIG_CARBON_EQUIP_HAT, I) - head_update(I) if(ITEM_SLOT_NECK) if(wear_neck) return wear_neck = I - update_worn_neck(I) + update_slots_for_item(I, slot) if(ITEM_SLOT_HANDCUFFED) set_handcuffed(I) @@ -152,22 +153,23 @@ head = null SEND_SIGNAL(src, COMSIG_CARBON_UNEQUIP_HAT, I, force, newloc, no_move, invdrop, silent) if(!QDELETED(src)) - head_update(I) + update_slots_for_item(I, ITEM_SLOT_HEAD) else if(I == back) back = null if(!QDELETED(src)) - update_worn_back() + update_slots_for_item(I, ITEM_SLOT_BACK) else if(I == wear_mask) wear_mask = null if(!QDELETED(src)) + update_slots_for_item(I, ITEM_SLOT_MASK) wear_mask_update(I, toggle_off = 1) else if(I == wear_neck) wear_neck = null if(!QDELETED(src)) - update_worn_neck(I) + update_slots_for_item(I, ITEM_SLOT_NECK) else if(I == handcuffed) set_handcuffed(null) @@ -179,7 +181,7 @@ else if(I == shoes) shoes = null if(!QDELETED(src)) - update_worn_shoes() + update_slots_for_item(I, ITEM_SLOT_FEET) else if(I == legcuffed) legcuffed = null @@ -204,17 +206,6 @@ update_tint() update_worn_mask() -//handle stuff to update when a mob equips/unequips a headgear. -/mob/living/carbon/proc/head_update(obj/item/I, forced) - if(istype(I, /obj/item/clothing)) - var/obj/item/clothing/C = I - if(C.tint || initial(C.tint)) - update_tint() - update_sight() - if(I.flags_inv & HIDEMASK || forced) - update_worn_mask() - update_worn_head() - /mob/living/carbon/proc/get_holding_bodypart_of_item(obj/item/I) var/index = get_held_index_of_item(I) return index && hand_bodyparts[index] @@ -338,3 +329,57 @@ for(var/obj/item/inv_item in get_all_worn_items()) if(zone & inv_item.body_parts_covered) return inv_item + +/// Update any visuals relating to an item when it's equipped, unequipped, or it's flags_inv changes. +/mob/living/carbon/proc/update_slots_for_item(obj/item/I, equipped_slot = null, force_obscurity_update) + if(isnull(equipped_slot)) + equipped_slot = get_slot_by_item(I) + if(is_holding(I)) + equipped_slot |= ITEM_SLOT_HANDS + + if(isnull(equipped_slot)) + return + + var/old_obscured_slots = obscured_slots + var/slots_to_update = equipped_slot + var/need_bodypart_update = FALSE + + if(I.flags_inv || force_obscurity_update) + update_obscurity() + var/new_obscured_slots = obscured_slots + var/updated_slots = old_obscured_slots ^ new_obscured_slots + + // Update slots that we were obscuring/are going to obscure + slots_to_update |= check_obscured_slots(input_slots = updated_slots) + + // Update name if we are changing face visibility + var/face_coverage_changed = updated_slots & HIDEFACE + if(face_coverage_changed) + update_name() + + // Update body incase any bodyparts or organs changed visibility + var/bodypart_coverage_changed = updated_slots & BODYPART_HIDE_FLAGS + if(bodypart_coverage_changed) + need_bodypart_update = TRUE + + switch(equipped_slot) + if(ITEM_SLOT_HEAD) + if(isclothing(I)) + var/obj/item/clothing/clothing_item = I + if(clothing_item.tint || initial(clothing_item.tint)) + update_tint() + + update_sight() + + if (invalid_internals()) + cutoff_internals() + + if(ishuman(src)) + var/mob/living/carbon/human/H = src + H.sec_hud_set_security_status() + + // Do the updates + if(need_bodypart_update) + update_body_parts() + + update_clothing(slots_to_update) diff --git a/code/modules/mod/mod_activation.dm b/code/modules/mod/mod_activation.dm index 46a7fe583588..dcbd26527793 100644 --- a/code/modules/mod/mod_activation.dm +++ b/code/modules/mod/mod_activation.dm @@ -189,26 +189,25 @@ part.heat_protection = NONE part.cold_protection = NONE part.alternate_worn_layer = mod_parts[part] + if(part == boots) boots.icon_state = "[skin]-boots[seal ? "-sealed" : ""]" - wearer.update_worn_shoes() + if(part == gauntlets) gauntlets.icon_state = "[skin]-gauntlets[seal ? "-sealed" : ""]" - wearer.update_worn_gloves() + if(part == chestplate) chestplate.icon_state = "[skin]-chestplate[seal ? "-sealed" : ""]" - wearer.update_worn_oversuit() - wearer.update_worn_undersuit() + if(part == helmet) helmet.icon_state = "[skin]-helmet[seal ? "-sealed" : ""]" - wearer.update_worn_head() - wearer.update_worn_mask() - wearer.update_worn_glasses() - wearer.update_body_parts() + // Close internal air tank if MOD helmet is unsealed and was the only breathing apparatus. if (!seal && wearer?.invalid_internals()) wearer.cutoff_internals() + wearer.update_slots_for_item(part) + /// Finishes the suit's activation, starts processing /obj/item/mod/control/proc/finish_activation(on) active = on diff --git a/code/modules/projectiles/guns/energy/laser_gatling.dm b/code/modules/projectiles/guns/energy/laser_gatling.dm index a1b2cebe5ef3..607527c9a73c 100644 --- a/code/modules/projectiles/guns/energy/laser_gatling.dm +++ b/code/modules/projectiles/guns/energy/laser_gatling.dm @@ -46,7 +46,7 @@ to_chat(user, span_warning("You need a free hand to hold the gun!")) return update_appearance() - user.update_worn_back() + update_slot_icon() else to_chat(user, span_warning("You are already holding the gun!")) else @@ -94,7 +94,7 @@ else src.visible_message(span_warning("The [gun.name] snaps back onto the [name]!")) update_appearance() - user.update_worn_back() + update_slot_icon() /obj/item/gun/energy/minigun diff --git a/code/modules/surgery/bodyparts/digitigrade.dm b/code/modules/surgery/bodyparts/digitigrade.dm index fb69d2285ab8..7127dbfc13b6 100644 --- a/code/modules/surgery/bodyparts/digitigrade.dm +++ b/code/modules/surgery/bodyparts/digitigrade.dm @@ -35,7 +35,7 @@ if((!human_owner.wear_suit) || (human_owner.wear_suit.supports_variations_flags & (CLOTHING_DIGITIGRADE_VARIATION|CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON)) || !(human_owner.wear_suit.body_parts_covered & LEGS)) //Checks suit compatability suit_compatible = TRUE - if((uniform_compatible && suit_compatible) || (suit_compatible && human_owner.wear_suit?.flags_inv & HIDEJUMPSUIT)) //If the uniform is hidden, it doesnt matter if its compatible + if((uniform_compatible && suit_compatible) || (suit_compatible && (human_owner.obscured_slots & HIDEJUMPSUIT))) //If the uniform is hidden, it doesnt matter if its compatible if(limb_id != digitigrade_id) old_limb_id = limb_id limb_id = digitigrade_id diff --git a/code/modules/surgery/bodyparts/species_parts/vox_bodyparts.dm b/code/modules/surgery/bodyparts/species_parts/vox_bodyparts.dm index 86b04a55fa7d..75bd8d0a82bf 100644 --- a/code/modules/surgery/bodyparts/species_parts/vox_bodyparts.dm +++ b/code/modules/surgery/bodyparts/species_parts/vox_bodyparts.dm @@ -51,7 +51,7 @@ if((!human_owner.wear_suit) || (human_owner.wear_suit.supports_variations_flags & CLOTHING_VOX_VARIATION) || !(human_owner.wear_suit.body_parts_covered & LEGS)) //Checks suit compatability suit_compatible = TRUE - if((uniform_compatible && suit_compatible) || (suit_compatible && human_owner.wear_suit?.flags_inv & HIDEJUMPSUIT)) //If the uniform is hidden, it doesnt matter if its compatible + if((uniform_compatible && suit_compatible) || (suit_compatible && (human_owner.obscured_slots & HIDEJUMPSUIT))) //If the uniform is hidden, it doesnt matter if its compatible limb_id = "vox_digitigrade" else @@ -75,7 +75,7 @@ if((!human_owner.wear_suit) || (human_owner.wear_suit.supports_variations_flags & CLOTHING_VOX_VARIATION) || !(human_owner.wear_suit.body_parts_covered & LEGS)) //Checks suit compatability suit_compatible = TRUE - if((uniform_compatible && suit_compatible) || (suit_compatible && human_owner.wear_suit?.flags_inv & HIDEJUMPSUIT)) //If the uniform is hidden, it doesnt matter if its compatible + if((uniform_compatible && suit_compatible) || (suit_compatible && (human_owner.obscured_slots & HIDEJUMPSUIT))) //If the uniform is hidden, it doesnt matter if its compatible limb_id = "vox_digitigrade" else diff --git a/code/modules/surgery/organs/external/_external_organs.dm b/code/modules/surgery/organs/external/_external_organs.dm index 53760e93ea1b..3e961523e6d3 100644 --- a/code/modules/surgery/organs/external/_external_organs.dm +++ b/code/modules/surgery/organs/external/_external_organs.dm @@ -86,7 +86,7 @@ dna_block = DNA_HORNS_BLOCK /obj/item/organ/horns/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR)) + if(!(human.obscured_slots & HIDEHAIR)) return TRUE return FALSE @@ -111,7 +111,7 @@ dna_block = DNA_FRILLS_BLOCK /obj/item/organ/frills/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.head?.flags_inv & HIDEEARS)) + if(!(human.obscured_slots & HIDEEARS)) return TRUE return FALSE @@ -202,7 +202,7 @@ color_source = ORGAN_COLOR_OVERRIDE /obj/item/organ/pod_hair/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR)) + if(!(human.obscured_slots & HIDEHAIR)) return TRUE return FALSE @@ -232,7 +232,7 @@ color_source = ORGAN_COLOR_HAIR /obj/item/organ/teshari_feathers/can_draw_on_bodypart(mob/living/carbon/human/human) - if(human.head && (human.head.flags_inv & HIDEHAIR) || human.wear_mask && (human.wear_mask.flags_inv & HIDEHAIR)) + if(human.obscured_slots & HIDEHAIR) return FALSE return TRUE @@ -257,7 +257,7 @@ dna_block = DNA_TESHARI_EARS_BLOCK /obj/item/organ/teshari_ears/can_draw_on_bodypart(mob/living/carbon/human/human) - if(human.head && (human.head.flags_inv & HIDEHAIR) || human.wear_mask && (human.wear_mask.flags_inv & HIDEHAIR)) + if(human.obscured_slots & HIDEHAIR) return FALSE return TRUE @@ -301,7 +301,7 @@ /obj/item/organ/teshari_body_feathers/can_draw_on_bodypart(mob/living/carbon/human/human) if(!human) return TRUE - if(human.wear_suit && (human.wear_suit.flags_inv & HIDEJUMPSUIT)) + if(human.obscured_slots & HIDEJUMPSUIT) return FALSE return TRUE diff --git a/code/modules/surgery/organs/external/ipc.dm b/code/modules/surgery/organs/external/ipc.dm index 12e5e3edc6b1..00a1232a740c 100644 --- a/code/modules/surgery/organs/external/ipc.dm +++ b/code/modules/surgery/organs/external/ipc.dm @@ -68,7 +68,7 @@ return GLOB.ipc_antenna_list /obj/item/organ/ipc_antenna/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR)) + if(!(human.obscured_slots & HIDEHAIR)) return TRUE return FALSE @@ -92,7 +92,7 @@ return GLOB.saurian_screens_list /obj/item/organ/saurian_screen/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.wear_mask?.flags_inv & HIDESNOUT) && !(human.head?.flags_inv & HIDESNOUT)) + if(!(human.obscured_slots & HIDESNOUT)) return TRUE return FALSE @@ -174,7 +174,7 @@ return GLOB.saurian_screens_list /obj/item/organ/saurian_screen/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.wear_mask?.flags_inv & HIDESNOUT) && !(human.head?.flags_inv & HIDESNOUT)) + if(!(human.obscured_slots & HIDESNOUT)) return TRUE return FALSE @@ -223,7 +223,7 @@ return GLOB.saurian_antenna_list /obj/item/organ/saurian_antenna/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR)) + if(!(human.obscured_slots & HIDEHAIR)) return TRUE return FALSE diff --git a/code/modules/surgery/organs/external/snouts.dm b/code/modules/surgery/organs/external/snouts.dm index 45c457ac9728..e592fc174c0a 100644 --- a/code/modules/surgery/organs/external/snouts.dm +++ b/code/modules/surgery/organs/external/snouts.dm @@ -16,7 +16,7 @@ dna_block = DNA_SNOUT_BLOCK /obj/item/organ/snout/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.wear_mask?.flags_inv & HIDESNOUT) && !(human.head?.flags_inv & HIDESNOUT)) + if(!(human.obscured_slots & HIDESNOUT)) return TRUE return FALSE diff --git a/code/modules/surgery/organs/external/spines.dm b/code/modules/surgery/organs/external/spines.dm index 6c5f6efd55f2..b35658ca5d10 100644 --- a/code/modules/surgery/organs/external/spines.dm +++ b/code/modules/surgery/organs/external/spines.dm @@ -20,7 +20,7 @@ /obj/item/organ/spines/can_draw_on_bodypart(mob/living/carbon/human/human) . = ..() - if(human.wear_suit && (human.wear_suit.flags_inv & HIDEJUMPSUIT)) + if(human.obscured_slots & HIDEJUMPSUIT) return FALSE /obj/item/organ/spines/Insert(mob/living/carbon/reciever, special, drop_if_replaced) diff --git a/code/modules/surgery/organs/external/tails.dm b/code/modules/surgery/organs/external/tails.dm index 7a95395b1e16..d29fccfffd2e 100644 --- a/code/modules/surgery/organs/external/tails.dm +++ b/code/modules/surgery/organs/external/tails.dm @@ -20,7 +20,7 @@ return ..() /obj/item/organ/tail/can_draw_on_bodypart(mob/living/carbon/human/human) - if(human.wear_suit && (human.wear_suit.flags_inv & HIDEJUMPSUIT)) + if(human.obscured_slots & HIDEJUMPSUIT) return FALSE return TRUE diff --git a/code/modules/surgery/organs/external/vox_hair.dm b/code/modules/surgery/organs/external/vox_hair.dm index 7f47297814a4..3765b9b4dedf 100644 --- a/code/modules/surgery/organs/external/vox_hair.dm +++ b/code/modules/surgery/organs/external/vox_hair.dm @@ -18,7 +18,7 @@ //draw_color = "#997C28" /obj/item/organ/vox_hair/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR)) + if(!(human.obscured_slots & HIDEHAIR)) return TRUE return FALSE diff --git a/code/modules/surgery/organs/external/wings.dm b/code/modules/surgery/organs/external/wings.dm index 4e7b89dc6fa9..69a744d8e5c2 100644 --- a/code/modules/surgery/organs/external/wings.dm +++ b/code/modules/surgery/organs/external/wings.dm @@ -12,9 +12,7 @@ feature_key = "wings" /obj/item/organ/wings/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!human.wear_suit) - return TRUE - if(!(human.wear_suit.flags_inv & HIDEJUMPSUIT)) + if(!(human.obscured_slots & HIDEJUMPSUIT)) return TRUE if(human.wear_suit.species_exception && is_type_in_list(src, human.wear_suit.species_exception)) return TRUE @@ -181,7 +179,7 @@ return GLOB.moth_wings_list /obj/item/organ/wings/moth/can_draw_on_bodypart(mob/living/carbon/human/human) - if(!(human.wear_suit?.flags_inv & HIDEMUTWINGS)) + if(!(human.obscured_slots & HIDEMUTWINGS)) return TRUE return FALSE diff --git a/modular_pariah/modules/customization/modules/clothing/glasses/glasses.dm b/modular_pariah/modules/customization/modules/clothing/glasses/glasses.dm index 63fddf494caf..4e4e1be08dcf 100644 --- a/modular_pariah/modules/customization/modules/clothing/glasses/glasses.dm +++ b/modular_pariah/modules/customization/modules/clothing/glasses/glasses.dm @@ -36,8 +36,8 @@ to_chat(usr, span_notice("You adjust the eyepatch to wear it over your left eye.")) else if(current_eye == "_R") to_chat(usr, span_notice("You adjust the eyepatch to wear it over your right eye.")) - usr.update_worn_glasses() - usr.update_overlays() + + update_slot_icon() /obj/item/clothing/glasses/proc/eyepatch_do_switch() if(current_eye == "_L")