From 2e11db2344e4c7f8d7cca52df09ef0770dde2d4b Mon Sep 17 00:00:00 2001 From: Fikou <23585223+Fikou@users.noreply.github.com> Date: Wed, 24 Apr 2024 21:59:58 +0200 Subject: [PATCH] [NO GBP] fixes issues with human rendering fixes (#82852) ## About The Pull Request fixes #82838, forgot to add the attack_self there fixes #82869 fixes the atmos hardhat not using flags_inv and transparent_protection correctly (you could pull off someones glasses through it for example makes modsuits use the new rendering stuff fixes rendering stuff not working correctly with adjustable clothing fixes quick equip dropping the item if you cant equip it ## Why It's Good For The Game waow its awesome ## Changelog :cl: fix: you can no longer take off someones glasses or mask through atmos hardhat fix: once you adjust a welding helmet or something it no longer makes your cigarette or sunglasses invisible fix: welding gas mask works once again fix: quick equips dont drop the item if you cant equip it /:cl: --- code/modules/clothing/clothing.dm | 5 +++- code/modules/clothing/glasses/_glasses.dm | 4 +++ code/modules/clothing/head/hardhat.dm | 3 +- code/modules/clothing/head/welding.dm | 1 + code/modules/clothing/masks/gasmask.dm | 4 +++ .../modules/mining/equipment/explorer_gear.dm | 1 - code/modules/mob/inventory.dm | 12 +++----- .../mob/living/carbon/carbon_update_icons.dm | 16 +++++----- .../living/carbon/human/human_update_icons.dm | 30 +++++++++---------- .../mob/living/carbon/human/inventory.dm | 2 +- code/modules/mob/living/carbon/inventory.dm | 2 +- code/modules/mob/mob_update_icons.dm | 23 +++++++------- code/modules/mod/mod_activation.dm | 19 +++--------- 13 files changed, 59 insertions(+), 63 deletions(-) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 6510d16bf9efd..e839acaf8cb98 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -470,7 +470,8 @@ BLIND // can't see anything female_clothing_icon = fcopy_rsc(female_clothing_icon) GLOB.female_clothing_icons[index] = female_clothing_icon -/obj/item/clothing/proc/adjust_visor(mob/living/user) //proc to toggle welding visors on helmets, masks, goggles, etc. +/// Proc that adjusts the clothing item, used by things like breathing masks, welding helmets, welding goggles etc. +/obj/item/clothing/proc/adjust_visor(mob/living/user) if(!can_use(user)) return FALSE @@ -483,6 +484,8 @@ BLIND // can't see anything if(user.is_holding(src)) user.update_held_items() return TRUE + if(up) + user.update_obscured_slots(visor_flags_inv) user.update_clothing(slot_flags) if(!iscarbon(user)) return TRUE diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index 5053e78bdaf11..358bff5ce80d5 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -450,6 +450,10 @@ /obj/item/clothing/glasses/welding/attack_self(mob/user) adjust_visor(user) +/obj/item/clothing/glasses/welding/update_icon_state() + . = ..() + icon_state = "[initial(icon_state)][up ? "up" : ""]" + /obj/item/clothing/glasses/welding/up/Initialize(mapload) . = ..() visor_toggling() diff --git a/code/modules/clothing/head/hardhat.dm b/code/modules/clothing/head/hardhat.dm index ebe8ab48c6861..018543d93a33c 100644 --- a/code/modules/clothing/head/hardhat.dm +++ b/code/modules/clothing/head/hardhat.dm @@ -194,7 +194,8 @@ min_cold_protection_temperature = FIRE_HELM_MIN_TEMP_PROTECT flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH | PEPPERPROOF visor_flags_cover = NONE - flags_inv = HIDEEARS|HIDEFACE|HIDEHAIR|HIDEFACIALHAIR|HIDESNOUT + flags_inv = HIDEEARS|HIDEHAIR|HIDEFACE|HIDEFACIALHAIR|HIDESNOUT + transparent_protection = HIDEMASK|HIDEEYES visor_flags_inv = NONE visor_state = "weldvisor_atmos" diff --git a/code/modules/clothing/head/welding.dm b/code/modules/clothing/head/welding.dm index 47433dd90f8e9..cb785447174f7 100644 --- a/code/modules/clothing/head/welding.dm +++ b/code/modules/clothing/head/welding.dm @@ -14,6 +14,7 @@ actions_types = list(/datum/action/item_action/toggle) visor_flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDESNOUT visor_flags_cover = HEADCOVERSEYES | HEADCOVERSMOUTH | PEPPERPROOF + visor_vars_to_toggle = VISOR_FLASHPROTECT | VISOR_TINT resistance_flags = FIRE_PROOF clothing_flags = SNUG_FIT | STACKABLE_HELMET_EXEMPT diff --git a/code/modules/clothing/masks/gasmask.dm b/code/modules/clothing/masks/gasmask.dm index 5cc18a28fbb06..e6f3d7294c9b3 100644 --- a/code/modules/clothing/masks/gasmask.dm +++ b/code/modules/clothing/masks/gasmask.dm @@ -219,6 +219,7 @@ GLOBAL_LIST_INIT(clown_mask_options, list( flags_cover = MASKCOVERSEYES visor_flags_inv = HIDEEYES visor_flags_cover = MASKCOVERSEYES + visor_vars_to_toggle = VISOR_FLASHPROTECT | VISOR_TINT resistance_flags = FIRE_PROOF /datum/armor/gas_welding @@ -227,6 +228,9 @@ GLOBAL_LIST_INIT(clown_mask_options, list( fire = 100 acid = 55 +/obj/item/clothing/mask/gas/welding/attack_self(mob/user) + adjust_visor(user) + /obj/item/clothing/mask/gas/welding/adjust_visor(mob/living/user) . = ..() if(.) diff --git a/code/modules/mining/equipment/explorer_gear.dm b/code/modules/mining/equipment/explorer_gear.dm index e4c0819d6733d..5485ce72f22cd 100644 --- a/code/modules/mining/equipment/explorer_gear.dm +++ b/code/modules/mining/equipment/explorer_gear.dm @@ -91,7 +91,6 @@ . = ..() // adjusted = out of the way = smaller = can fit in boxes update_weight_class(up ? WEIGHT_CLASS_SMALL : WEIGHT_CLASS_NORMAL) - inhand_icon_state = up ? "[initial(inhand_icon_state)]_up" : initial(inhand_icon_state) /obj/item/clothing/mask/gas/explorer/update_icon_state() . = ..() diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 4dab3f9d70292..f5afac95086ec 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -429,10 +429,10 @@ var/obscured = NONE var/hidden_slots = NONE - for(var/obj/item/I in get_equipped_items()) - hidden_slots |= I.flags_inv + for(var/obj/item/equipped_item in get_equipped_items()) + hidden_slots |= equipped_item.flags_inv if(transparent_protection) - hidden_slots |= I.transparent_protection + hidden_slots |= equipped_item.transparent_protection if(hidden_slots & HIDENECK) obscured |= ITEM_SLOT_NECK @@ -510,11 +510,7 @@ to_chat(src, span_warning("You are not holding anything to equip!")) return if(!QDELETED(I)) - if(I.equip_to_best_slot(src)) - return - if(put_in_active_hand(I)) - return - I.forceMove(drop_location()) + I.equip_to_best_slot(src) //used in code for items usable by both carbon and drones, this gives the proper back slot for each mob.(defibrillator, backpack watertank, ...) /mob/proc/getBackSlot() diff --git a/code/modules/mob/living/carbon/carbon_update_icons.dm b/code/modules/mob/living/carbon/carbon_update_icons.dm index fab921ba19a7f..00e502bad0451 100644 --- a/code/modules/mob/living/carbon/carbon_update_icons.dm +++ b/code/modules/mob/living/carbon/carbon_update_icons.dm @@ -1,6 +1,6 @@ -/mob/living/carbon/update_obscured_slots(obj/item/worn_item) +/mob/living/carbon/update_obscured_slots(obscured_flags) ..() - if(worn_item.flags_inv & (HIDEEARS|HIDEEYES|HIDEHAIR|HIDEFACIALHAIR|HIDESNOUT|HIDEMUTWINGS)) + if(obscured_flags & (HIDEEARS|HIDEEYES|HIDEHAIR|HIDEFACIALHAIR|HIDESNOUT|HIDEMUTWINGS)) update_body() /// Updates features and clothing attached to a specific limb with limb-specific offsets @@ -344,7 +344,7 @@ if(wear_mask) if(update_obscured) - update_obscured_slots(wear_mask) + update_obscured_slots(wear_mask.flags_inv) if(!(check_obscured_slots() & ITEM_SLOT_MASK)) overlays_standing[FACEMASK_LAYER] = wear_mask.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = 'icons/mob/clothing/mask.dmi') update_hud_wear_mask(wear_mask) @@ -360,7 +360,7 @@ if(wear_neck) if(update_obscured) - update_obscured_slots(wear_neck) + update_obscured_slots(wear_neck.flags_inv) if(!(check_obscured_slots() & ITEM_SLOT_NECK)) overlays_standing[NECK_LAYER] = wear_neck.build_worn_icon(default_layer = NECK_LAYER, default_icon_file = 'icons/mob/clothing/neck.dmi') update_hud_neck(wear_neck) @@ -376,7 +376,7 @@ if(back) if(update_obscured) - update_obscured_slots(back) + update_obscured_slots(back.flags_inv) overlays_standing[BACK_LAYER] = back.build_worn_icon(default_layer = BACK_LAYER, default_icon_file = 'icons/mob/clothing/back.dmi') update_hud_back(back) @@ -387,7 +387,7 @@ clear_alert("legcuffed") if(legcuffed) if(update_obscured) - update_obscured_slots(legcuffed) + update_obscured_slots(legcuffed.flags_inv) overlays_standing[LEGCUFF_LAYER] = mutable_appearance('icons/mob/simple/mob.dmi', "legcuff1", -LEGCUFF_LAYER) apply_overlay(LEGCUFF_LAYER) throw_alert("legcuffed", /atom/movable/screen/alert/restrained/legcuffed, new_master = src.legcuffed) @@ -404,7 +404,7 @@ if(head) if(update_obscured) - update_obscured_slots(head) + update_obscured_slots(head.flags_inv) if(!(check_obscured_slots() & ITEM_SLOT_HEAD)) overlays_standing[HEAD_LAYER] = head.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = 'icons/mob/clothing/head/default.dmi') update_hud_head(head) @@ -416,7 +416,7 @@ remove_overlay(HANDCUFF_LAYER) if(handcuffed) if(update_obscured) - update_obscured_slots(handcuffed) + update_obscured_slots(handcuffed.flags_inv) var/mutable_appearance/handcuff_overlay = mutable_appearance('icons/mob/simple/mob.dmi', "handcuff1", -HANDCUFF_LAYER) if(handcuffed.blocks_emissive != EMISSIVE_BLOCK_NONE) handcuff_overlay.overlays += emissive_blocker(handcuff_overlay.icon, handcuff_overlay.icon_state, src, alpha = handcuff_overlay.alpha) 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 1b2b85151716e..bd320079b65d5 100644 --- a/code/modules/mob/living/carbon/human/human_update_icons.dm +++ b/code/modules/mob/living/carbon/human/human_update_icons.dm @@ -70,9 +70,9 @@ There are several things that need to be remembered: //damage overlays update_damage_overlays() -/mob/living/carbon/human/update_obscured_slots(obj/item/worn_item) +/mob/living/carbon/human/update_obscured_slots(obscured_flags) ..() - if(worn_item.flags_inv & HIDEFACE) + if(obscured_flags & HIDEFACE) sec_hud_set_security_status() /* --------------------------------------- */ @@ -90,7 +90,7 @@ There are several things that need to be remembered: update_hud_uniform(uniform) if(update_obscured) - update_obscured_slots(uniform) + update_obscured_slots(uniform.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_ICLOTHING) return @@ -151,7 +151,7 @@ There are several things that need to be remembered: update_hud_id(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) var/icon_file = 'icons/mob/clothing/id.dmi' @@ -193,7 +193,7 @@ There are several things that need to be remembered: update_hud_gloves(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_GLOVES) return @@ -230,7 +230,7 @@ There are several things that need to be remembered: update_hud_glasses(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_EYES) return @@ -259,7 +259,7 @@ There are several things that need to be remembered: update_hud_ears(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_EARS) return @@ -283,7 +283,7 @@ There are several things that need to be remembered: update_hud_neck(wear_neck) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_NECK) return @@ -312,7 +312,7 @@ There are several things that need to be remembered: update_hud_shoes(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_FEET) return @@ -352,7 +352,7 @@ There are several things that need to be remembered: update_hud_s_store(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_SUITSTORE) return @@ -374,7 +374,7 @@ There are several things that need to be remembered: update_hud_head(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_HEAD) return @@ -400,7 +400,7 @@ There are several things that need to be remembered: update_hud_belt(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_BELT) return @@ -426,7 +426,7 @@ There are several things that need to be remembered: update_hud_wear_suit(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) var/icon_file = DEFAULT_SUIT_FILE @@ -477,7 +477,7 @@ There are several things that need to be remembered: update_hud_wear_mask(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_MASK) return @@ -504,7 +504,7 @@ There are several things that need to be remembered: update_hud_back(worn_item) if(update_obscured) - update_obscured_slots(worn_item) + update_obscured_slots(worn_item.flags_inv) var/icon_file = 'icons/mob/clothing/back.dmi' diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 47b08cd7a0a0b..32ab7ca1b900a 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -280,7 +280,7 @@ return update_equipment_speed_mods() - update_obscured_slots(I) + update_obscured_slots(I.flags_inv) /mob/living/carbon/human/toggle_internals(obj/item/tank, is_external = FALSE) // Just close the tank if it's the one the mob already has open. diff --git a/code/modules/mob/living/carbon/inventory.dm b/code/modules/mob/living/carbon/inventory.dm index 27477791092cf..45ca4487184e3 100644 --- a/code/modules/mob/living/carbon/inventory.dm +++ b/code/modules/mob/living/carbon/inventory.dm @@ -204,7 +204,7 @@ return update_equipment_speed_mods() - update_obscured_slots(I) + update_obscured_slots(I.flags_inv) /// Returns TRUE if an air tank compatible helmet is equipped. /mob/living/carbon/proc/can_breathe_helmet() diff --git a/code/modules/mob/mob_update_icons.dm b/code/modules/mob/mob_update_icons.dm index 7da3dddce3294..a355a385d9faa 100644 --- a/code/modules/mob/mob_update_icons.dm +++ b/code/modules/mob/mob_update_icons.dm @@ -42,26 +42,25 @@ if(slot_flags & ITEM_SLOT_HANDS) update_held_items() -///Updates item slots obscured by this item -/mob/proc/update_obscured_slots(obj/item/worn_item) - var/obscured_slots = worn_item.flags_inv - if(obscured_slots & HIDEGLOVES) +///Updates item slots obscured by this item (or using an override of flags to check) +/mob/proc/update_obscured_slots(obscured_flags) + if(obscured_flags & HIDEGLOVES) update_worn_gloves(update_obscured = FALSE) - if(obscured_slots & HIDESUITSTORAGE) + if(obscured_flags & HIDESUITSTORAGE) update_suit_storage(update_obscured = FALSE) - if(obscured_slots & HIDEJUMPSUIT) + if(obscured_flags & HIDEJUMPSUIT) update_worn_undersuit(update_obscured = FALSE) - if(obscured_slots & HIDESHOES) + if(obscured_flags & HIDESHOES) update_worn_shoes(update_obscured = FALSE) - if(obscured_slots & HIDEMASK) + if(obscured_flags & HIDEMASK) update_worn_mask(update_obscured = FALSE) - if(obscured_slots & HIDEEARS) + if(obscured_flags & HIDEEARS) update_worn_ears(update_obscured = FALSE) - if(obscured_slots & HIDEEYES) + if(obscured_flags & HIDEEYES) update_worn_glasses(update_obscured = FALSE) - if(obscured_slots & HIDENECK) + if(obscured_flags & HIDENECK) update_worn_neck(update_obscured = FALSE) - if(obscured_slots & HIDEHEADGEAR) + if(obscured_flags & HIDEHEADGEAR) update_worn_head(update_obscured = FALSE) /mob/proc/update_icons() diff --git a/code/modules/mod/mod_activation.dm b/code/modules/mod/mod_activation.dm index f95125d2a6e17..0d150c15fe61a 100644 --- a/code/modules/mod/mod_activation.dm +++ b/code/modules/mod/mod_activation.dm @@ -212,21 +212,10 @@ part.heat_protection = NONE part.cold_protection = NONE part.alternate_worn_layer = mod_parts[part] - if(part == boots) - wearer.update_worn_shoes() - if(part == gauntlets) - wearer.update_worn_gloves() - if(part == chestplate) - wearer.update_worn_oversuit() - wearer.update_worn_undersuit() - if(part == helmet) - 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_clothing(part.slot_flags) + wearer.update_obscured_slots(part.visor_flags_inv) + if((part.clothing_flags & (MASKINTERNALS|HEADINTERNALS)) && wearer.invalid_internals()) + wearer.cutoff_internals() /// Finishes the suit's activation /obj/item/mod/control/proc/finish_activation(on)