Skip to content

Commit

Permalink
Fixes many instances of item obscurity not working as intended. (#824)
Browse files Browse the repository at this point in the history
* fixes item obscurity

* more fixes
  • Loading branch information
Kapu1178 authored Feb 23, 2024
1 parent 500f4fa commit d29075f
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 72 deletions.
2 changes: 1 addition & 1 deletion code/modules/clothing/under/skirt_dress.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
icon_state = "wedding_dress"
inhand_icon_state = "wedding_dress"
body_parts_covered = CHEST|GROIN|LEGS
flags_cover = HIDESHOES
flags_inv = HIDESHOES
supports_variations_flags = CLOTHING_DIGITIGRADE_VARIATION_NO_NEW_ICON | CLOTHING_TESHARI_VARIATION | CLOTHING_VOX_VARIATION

/obj/item/clothing/under/dress/redeveninggown
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
update_worn_undersuit()
if(slot_flags & ITEM_SLOT_SUITSTORE)
update_suit_storage()
if(slot_flags & ITEM_SLOT_LPOCKET || slot_flags & ITEM_SLOT_RPOCKET)
if(slot_flags & (ITEM_SLOT_LPOCKET|ITEM_SLOT_RPOCKET))
update_pockets()


Expand Down
183 changes: 113 additions & 70 deletions code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ There are several things that need to be remembered:
var/obj/item/clothing/under/uniform = w_uniform
update_hud_uniform(uniform)

if(wear_suit && (wear_suit.flags_inv & HIDEJUMPSUIT))
if(check_obscured_slots() & ITEM_SLOT_ICLOTHING)
return


Expand Down Expand Up @@ -150,6 +150,10 @@ There are several things that need to be remembered:
if(wear_id)
var/obj/item/worn_item = wear_id
update_hud_id(worn_item)

if(check_obscured_slots() & ITEM_SLOT_ID)
return

var/handled_by_bodytype = TRUE
var/icon_file

Expand Down Expand Up @@ -194,6 +198,10 @@ There are several things that need to be remembered:
if(gloves)
var/obj/item/worn_item = gloves
update_hud_gloves(worn_item)

if(check_obscured_slots() & ITEM_SLOT_GLOVES)
return

var/icon_file
var/handled_by_bodytype = TRUE
if(dna.species.bodytype & BODYTYPE_TESHARI)
Expand Down Expand Up @@ -240,31 +248,34 @@ There are several things that need to be remembered:
var/mutable_appearance/glasses_overlay
update_hud_glasses(worn_item)

if(check_obscured_slots() & ITEM_SLOT_EYES)
return

var/handled_by_bodytype = TRUE
var/icon_file
if(!(head?.flags_inv & HIDEEYES) && !(wear_mask?.flags_inv & HIDEEYES))
if(dna.species.bodytype & BODYTYPE_TESHARI)
if(glasses.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
icon_file = TESHARI_EYES_FILE
if(dna.species.bodytype & BODYTYPE_TESHARI)
if(glasses.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
icon_file = TESHARI_EYES_FILE

if(dna.species.bodytype & BODYTYPE_VOX_OTHER)
if(worn_item.supports_variations_flags & CLOTHING_VOX_VARIATION)
icon_file = worn_item.worn_icon_vox || VOX_EYES_FILE
if(dna.species.bodytype & BODYTYPE_VOX_OTHER)
if(worn_item.supports_variations_flags & CLOTHING_VOX_VARIATION)
icon_file = worn_item.worn_icon_vox || VOX_EYES_FILE

if(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/eyes.dmi'
handled_by_bodytype = FALSE
if(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/eyes.dmi'
handled_by_bodytype = FALSE

glasses_overlay = glasses.build_worn_icon(
src,
default_layer = GLASSES_LAYER,
default_icon_file = icon_file,
override_file = handled_by_bodytype ? icon_file : null,
fallback = handled_by_bodytype ? null : dna.species.fallback_clothing_path
)
glasses_overlay = glasses.build_worn_icon(
src,
default_layer = GLASSES_LAYER,
default_icon_file = icon_file,
override_file = handled_by_bodytype ? icon_file : null,
fallback = handled_by_bodytype ? null : dna.species.fallback_clothing_path
)

if(!glasses_overlay)
return

if(!handled_by_bodytype && (OFFSET_GLASSES in dna.species.offset_features))
glasses_overlay.pixel_x += dna.species.offset_features[OFFSET_GLASSES][1]
glasses_overlay.pixel_y += dna.species.offset_features[OFFSET_GLASSES][2]
Expand All @@ -287,6 +298,9 @@ There are several things that need to be remembered:
var/mutable_appearance/ears_overlay
update_hud_ears(worn_item)

if(check_obscured_slots() & ITEM_SLOT_EARS)
return

var/handled_by_bodytype = TRUE
var/icon_file
if(dna.species.bodytype & BODYTYPE_TESHARI)
Expand Down Expand Up @@ -321,32 +335,35 @@ There are several things that need to be remembered:
if(wear_neck)
var/obj/item/worn_item = wear_neck
update_hud_neck(wear_neck)
if(!(check_obscured_slots() & ITEM_SLOT_NECK))
var/mutable_appearance/neck_overlay
var/icon_file
var/handled_by_bodytype = TRUE
if(dna.species.bodytype & BODYTYPE_TESHARI)
if(worn_item.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
icon_file = TESHARI_NECK_FILE

if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
handled_by_bodytype = FALSE
icon_file = 'icons/mob/clothing/neck.dmi'
if(check_obscured_slots() & ITEM_SLOT_NECK)
return

neck_overlay = worn_item.build_worn_icon(
src,
default_layer = NECK_LAYER,
default_icon_file = icon_file,
override_file = handled_by_bodytype ? icon_file : null,
fallback = handled_by_bodytype ? null : dna.species.fallback_clothing_path
)
var/mutable_appearance/neck_overlay
var/icon_file
var/handled_by_bodytype = TRUE
if(dna.species.bodytype & BODYTYPE_TESHARI)
if(worn_item.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
icon_file = TESHARI_NECK_FILE

if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
handled_by_bodytype = FALSE
icon_file = 'icons/mob/clothing/neck.dmi'

neck_overlay = worn_item.build_worn_icon(
src,
default_layer = NECK_LAYER,
default_icon_file = icon_file,
override_file = handled_by_bodytype ? icon_file : null,
fallback = handled_by_bodytype ? null : dna.species.fallback_clothing_path
)

if(!neck_overlay)
return
if(!handled_by_bodytype && (OFFSET_NECK in dna.species.offset_features))
neck_overlay.pixel_x += dna.species.offset_features[OFFSET_NECK][1]
neck_overlay.pixel_y += dna.species.offset_features[OFFSET_NECK][2]
overlays_standing[NECK_LAYER] = neck_overlay
if(!neck_overlay)
return
if(!handled_by_bodytype && (OFFSET_NECK in dna.species.offset_features))
neck_overlay.pixel_x += dna.species.offset_features[OFFSET_NECK][1]
neck_overlay.pixel_y += dna.species.offset_features[OFFSET_NECK][2]
overlays_standing[NECK_LAYER] = neck_overlay

apply_overlay(NECK_LAYER)

Expand All @@ -365,6 +382,10 @@ There are several things that need to be remembered:
var/mutable_appearance/shoes_overlay
var/icon_file
update_hud_shoes(worn_item)

if(check_obscured_slots() & ITEM_SLOT_FEET)
return

var/handled_by_bodytype = TRUE

if((dna.species.bodytype & BODYTYPE_DIGITIGRADE) && (worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
Expand Down Expand Up @@ -416,6 +437,9 @@ There are several things that need to be remembered:
var/mutable_appearance/s_store_overlay
update_hud_s_store(worn_item)

if(check_obscured_slots() & ITEM_SLOT_SUITSTORE)
return

s_store_overlay = worn_item.build_worn_icon(src, default_layer = SUIT_STORE_LAYER, default_icon_file = 'icons/mob/clothing/belt_mirror.dmi')

if(!s_store_overlay)
Expand All @@ -436,6 +460,10 @@ There are several things that need to be remembered:
var/obj/item/worn_item = head
var/mutable_appearance/head_overlay
update_hud_head(worn_item)

if(check_obscured_slots() & ITEM_SLOT_HEAD)
return

var/handled_by_bodytype = TRUE //PARIAH EDIT
var/icon_file

Expand Down Expand Up @@ -482,6 +510,10 @@ There are several things that need to be remembered:
var/obj/item/worn_item = belt
var/mutable_appearance/belt_overlay
update_hud_belt(worn_item)

if(check_obscured_slots() & ITEM_SLOT_BELT)
return

var/handled_by_bodytype = TRUE
var/icon_file
if(dna.species.bodytype & BODYTYPE_TESHARI)
Expand Down Expand Up @@ -523,15 +555,19 @@ There are several things that need to be remembered:
var/obj/item/worn_item = wear_suit
var/mutable_appearance/suit_overlay
update_hud_wear_suit(worn_item)
var/icon_file

if(check_obscured_slots() & ITEM_SLOT_OCLOTHING)
return

var/icon_file
var/handled_by_bodytype = TRUE

//PARIAH EDIT
//More currently unused digitigrade handling
if(dna.species.bodytype & BODYTYPE_DIGITIGRADE)
if(worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION)
icon_file = wear_suit.worn_icon_digitigrade || DIGITIGRADE_SUIT_FILE //PARIAH EDIT

//PARIAH EDIT END
if(dna.species.bodytype & BODYTYPE_TESHARI)
if(worn_item.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
Expand Down Expand Up @@ -599,41 +635,43 @@ There are several things that need to be remembered:
var/obj/item/worn_item = wear_mask
update_hud_wear_mask(worn_item)

if(!(check_obscured_slots() & ITEM_SLOT_MASK))
var/mutable_appearance/mask_overlay
var/icon_file
var/handled_by_bodytype = TRUE
if(check_obscured_slots() & ITEM_SLOT_MASK)
return

var/mutable_appearance/mask_overlay
var/icon_file
var/handled_by_bodytype = TRUE

if(dna.species.bodytype & BODYTYPE_SNOUTED)
if(worn_item.supports_variations_flags & CLOTHING_SNOUTED_VARIATION)
icon_file = wear_mask.worn_icon_snouted || SNOUTED_MASK_FILE
if(dna.species.bodytype & BODYTYPE_SNOUTED)
if(worn_item.supports_variations_flags & CLOTHING_SNOUTED_VARIATION)
icon_file = wear_mask.worn_icon_snouted || SNOUTED_MASK_FILE

if(dna.species.bodytype & BODYTYPE_VOX_BEAK)
if(worn_item.supports_variations_flags & CLOTHING_VOX_VARIATION)
icon_file = worn_item.worn_icon_vox || VOX_MASK_FILE
if(dna.species.bodytype & BODYTYPE_VOX_BEAK)
if(worn_item.supports_variations_flags & CLOTHING_VOX_VARIATION)
icon_file = worn_item.worn_icon_vox || VOX_MASK_FILE

if(dna.species.bodytype & BODYTYPE_TESHARI)
if(worn_item.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
icon_file = TESHARI_MASK_FILE
if(dna.species.bodytype & BODYTYPE_TESHARI)
if(worn_item.supports_variations_flags & CLOTHING_TESHARI_VARIATION)
icon_file = TESHARI_MASK_FILE

if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/mask.dmi'
handled_by_bodytype = FALSE
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/mask.dmi'
handled_by_bodytype = FALSE

mask_overlay = wear_mask.build_worn_icon(
src,
default_layer = FACEMASK_LAYER,
default_icon_file = icon_file,
override_file = handled_by_bodytype ? icon_file : null
)
mask_overlay = wear_mask.build_worn_icon(
src,
default_layer = FACEMASK_LAYER,
default_icon_file = icon_file,
override_file = handled_by_bodytype ? icon_file : null
)

if(!mask_overlay)
return
if(!handled_by_bodytype && (OFFSET_FACEMASK in dna.species.offset_features))
mask_overlay.pixel_x += dna.species.offset_features[OFFSET_FACEMASK][1]
mask_overlay.pixel_y += dna.species.offset_features[OFFSET_FACEMASK][2]
if(!mask_overlay)
return
if(!handled_by_bodytype && (OFFSET_FACEMASK in dna.species.offset_features))
mask_overlay.pixel_x += dna.species.offset_features[OFFSET_FACEMASK][1]
mask_overlay.pixel_y += dna.species.offset_features[OFFSET_FACEMASK][2]

overlays_standing[FACEMASK_LAYER] = mask_overlay
overlays_standing[FACEMASK_LAYER] = mask_overlay

apply_overlay(FACEMASK_LAYER)
update_body_parts() //Snoots
Expand All @@ -648,7 +686,12 @@ There are several things that need to be remembered:
if(back)
var/obj/item/worn_item = back
var/mutable_appearance/back_overlay

update_hud_back(worn_item)

if(check_obscured_slots() & ITEM_SLOT_BACK)
return

var/icon_file
var/handled_by_bodytype = TRUE
if(dna.species.bodytype & BODYTYPE_TESHARI)
Expand Down

0 comments on commit d29075f

Please sign in to comment.