Skip to content

Commit

Permalink
[NO GBP] fixes issues with human rendering fixes (tgstation#82852)
Browse files Browse the repository at this point in the history
## About The Pull Request
fixes tgstation#82838, forgot to add the attack_self there
fixes tgstation#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:
  • Loading branch information
Fikou authored Apr 24, 2024
1 parent 59a20eb commit 2e11db2
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 63 deletions.
5 changes: 4 additions & 1 deletion code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions code/modules/clothing/glasses/_glasses.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion code/modules/clothing/head/hardhat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions code/modules/clothing/head/welding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions code/modules/clothing/masks/gasmask.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(.)
Expand Down
1 change: 0 additions & 1 deletion code/modules/mining/equipment/explorer_gear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
. = ..()
Expand Down
12 changes: 4 additions & 8 deletions code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
16 changes: 8 additions & 8 deletions code/modules/mob/living/carbon/carbon_update_icons.dm
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)

Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
30 changes: 15 additions & 15 deletions code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()

/* --------------------------------------- */
Expand All @@ -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
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
23 changes: 11 additions & 12 deletions code/modules/mob/mob_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
19 changes: 4 additions & 15 deletions code/modules/mod/mod_activation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2e11db2

Please sign in to comment.