Skip to content

Commit

Permalink
Cherry-picks hide flags fix (MrMelbert#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMelbert authored Dec 27, 2022
1 parent a3d2359 commit 8a56be0
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 102 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 @@ -25,7 +25,7 @@
icon_state = "wedding_dress"
inhand_icon_state = null
body_parts_covered = CHEST|GROIN|LEGS
flags_cover = HIDESHOES
flags_inv = HIDESHOES

/obj/item/clothing/under/dress/redeveninggown
name = "red evening gown"
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()

//IMPORTANT: Multiple animate() calls do not stack well, so try to do them all at once if you can.
Expand Down
176 changes: 78 additions & 98 deletions code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ 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(transparent_protection = TRUE) & ITEM_SLOT_ICLOTHING)
return


var/target_overlay = uniform.icon_state
if(uniform.adjusted == ALT_STYLE)
target_overlay = "[target_overlay]_d"

var/mutable_appearance/uniform_overlay

//This is how non-humanoid clothing works. You check if the mob has the right bodyflag, and the clothing has the corresponding clothing flag.
//handled_by_bodytype is used to track whether or not we successfully used an alternate sprite. It's set to TRUE to ease up on copy-paste.
//icon_file MUST be set to null by default, or it causes issues.
Expand All @@ -103,34 +101,33 @@ There are several things that need to be remembered:
var/handled_by_bodytype = TRUE
var/icon_file
var/woman
if(!uniform_overlay)
//BEGIN SPECIES HANDLING
if((dna?.species.bodytype & BODYTYPE_MONKEY) && (uniform.supports_variations_flags & CLOTHING_MONKEY_VARIATION))
icon_file = MONKEY_UNIFORM_FILE
else if((dna?.species.bodytype & BODYTYPE_DIGITIGRADE) && (uniform.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
// NON-MODULE CHANGE kapu why
if(uniform.greyscale_config_worn && uniform.digitigrade_greyscale_config_worn && uniform.greyscale_colors)
icon_file = SSgreyscale.GetColoredIconByType(uniform.digitigrade_greyscale_config_worn, uniform.greyscale_colors)
else
icon_file = uniform.digitigrade_file
// NON-MODULE CHANGE END
//Female sprites have lower priority than digitigrade sprites
else if(dna.species.sexes && (dna.species.bodytype & BODYTYPE_HUMANOID) && physique == FEMALE && !(uniform.female_sprite_flags & NO_FEMALE_UNIFORM)) //Agggggggghhhhh
woman = TRUE

if(!icon_exists(icon_file, RESOLVE_ICON_STATE(uniform)))
icon_file = DEFAULT_UNIFORM_FILE
handled_by_bodytype = FALSE

//END SPECIES HANDLING
uniform_overlay = uniform.build_worn_icon(
default_layer = UNIFORM_LAYER,
default_icon_file = icon_file,
isinhands = FALSE,
female_uniform = woman ? uniform.female_sprite_flags : null,
override_state = target_overlay,
override_file = handled_by_bodytype ? icon_file : null,
)
//BEGIN SPECIES HANDLING
if((dna?.species.bodytype & BODYTYPE_MONKEY) && (uniform.supports_variations_flags & CLOTHING_MONKEY_VARIATION))
icon_file = MONKEY_UNIFORM_FILE
else if((dna?.species.bodytype & BODYTYPE_DIGITIGRADE) && (uniform.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
// NON-MODULE CHANGE kapu why
if(uniform.greyscale_config_worn && uniform.digitigrade_greyscale_config_worn && uniform.greyscale_colors)
icon_file = SSgreyscale.GetColoredIconByType(uniform.digitigrade_greyscale_config_worn, uniform.greyscale_colors)
else
icon_file = uniform.digitigrade_file
// NON-MODULE CHANGE END
//Female sprites have lower priority than digitigrade sprites
else if(dna.species.sexes && (dna.species.bodytype & BODYTYPE_HUMANOID) && physique == FEMALE && !(uniform.female_sprite_flags & NO_FEMALE_UNIFORM)) //Agggggggghhhhh
woman = TRUE

if(!icon_exists(icon_file, RESOLVE_ICON_STATE(uniform)))
icon_file = DEFAULT_UNIFORM_FILE
handled_by_bodytype = FALSE

//END SPECIES HANDLING
uniform_overlay = uniform.build_worn_icon(
default_layer = UNIFORM_LAYER,
default_icon_file = icon_file,
isinhands = FALSE,
female_uniform = woman ? uniform.female_sprite_flags : null,
override_state = target_overlay,
override_file = handled_by_bodytype ? icon_file : null,
)

if(OFFSET_UNIFORM in dna.species.offset_features)
uniform_overlay?.pixel_x += dna.species.offset_features[OFFSET_UNIFORM][1]
Expand Down Expand Up @@ -190,19 +187,18 @@ There are several things that need to be remembered:
add_overlay(bloody_overlay)
//Bloody hands end

var/mutable_appearance/gloves_overlay
if(gloves)
var/obj/item/worn_item = gloves
update_hud_gloves(worn_item)
var/icon_file

if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_GLOVES)
return

var/icon_file
if(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/hands.dmi'

gloves_overlay = gloves.build_worn_icon(default_layer = GLOVES_LAYER, default_icon_file = icon_file)

if(!gloves_overlay)
return
var/mutable_appearance/gloves_overlay = gloves.build_worn_icon(default_layer = GLOVES_LAYER, default_icon_file = icon_file)
if(OFFSET_GLOVES in dna.species.offset_features)
gloves_overlay.pixel_x += dna.species.offset_features[OFFSET_GLOVES][1]
gloves_overlay.pixel_y += dna.species.offset_features[OFFSET_GLOVES][2]
Expand All @@ -222,19 +218,16 @@ There are several things that need to be remembered:

if(glasses)
var/obj/item/worn_item = glasses
var/mutable_appearance/glasses_overlay
update_hud_glasses(worn_item)

var/icon_file
if(!(head?.flags_inv & HIDEEYES) && !(wear_mask?.flags_inv & HIDEEYES))

if(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/eyes.dmi'
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_EYES)
return

glasses_overlay = glasses.build_worn_icon(default_layer = GLASSES_LAYER, default_icon_file = icon_file)
var/icon_file
if(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/eyes.dmi'

if(!glasses_overlay)
return
var/mutable_appearance/glasses_overlay = glasses.build_worn_icon(default_layer = GLASSES_LAYER, default_icon_file = icon_file)
if(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 @@ -254,18 +247,16 @@ There are several things that need to be remembered:

if(ears)
var/obj/item/worn_item = ears
var/mutable_appearance/ears_overlay
update_hud_ears(worn_item)

var/icon_file
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_EARS)
return

var/icon_file
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/ears.dmi'

ears_overlay = ears.build_worn_icon(default_layer = EARS_LAYER, default_icon_file = icon_file)

if(!ears_overlay)
return
var/mutable_appearance/ears_overlay = ears.build_worn_icon(default_layer = EARS_LAYER, default_icon_file = icon_file)
if(OFFSET_EARS in dna.species.offset_features)
ears_overlay.pixel_x += dna.species.offset_features[OFFSET_EARS][1]
ears_overlay.pixel_y += dna.species.offset_features[OFFSET_EARS][2]
Expand All @@ -282,21 +273,19 @@ 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(!(ITEM_SLOT_NECK & check_obscured_slots()))
var/mutable_appearance/neck_overlay
var/icon_file

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

neck_overlay = worn_item.build_worn_icon(default_layer = NECK_LAYER, default_icon_file = icon_file)
var/icon_file
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/neck.dmi'

if(!neck_overlay)
return
if(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
var/mutable_appearance/neck_overlay = worn_item.build_worn_icon(default_layer = NECK_LAYER, default_icon_file = icon_file)
if(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 @@ -312,10 +301,12 @@ There are several things that need to be remembered:

if(shoes)
var/obj/item/worn_item = shoes
var/mutable_appearance/shoes_overlay
var/icon_file
update_hud_shoes(worn_item)

if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_FEET)
return

var/icon_file
// NON-MODULE CHANGE becuase kapu why
if((dna.species.bodytype & BODYTYPE_DIGITIGRADE) && (worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
var/obj/item/bodypart/leg = src.get_bodypart(BODY_ZONE_L_LEG)
Expand All @@ -326,8 +317,7 @@ There are several things that need to be remembered:
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = DEFAULT_SHOES_FILE

shoes_overlay = shoes.build_worn_icon(default_layer = SHOES_LAYER, default_icon_file = icon_file)

var/mutable_appearance/shoes_overlay = shoes.build_worn_icon(default_layer = SHOES_LAYER, default_icon_file = icon_file)
if(!shoes_overlay)
return
if(OFFSET_SHOES in dna.species.offset_features)
Expand All @@ -349,13 +339,12 @@ There are several things that need to be remembered:

if(s_store)
var/obj/item/worn_item = s_store
var/mutable_appearance/s_store_overlay
update_hud_s_store(worn_item)

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

if(!s_store_overlay)
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_SUITSTORE)
return

var/mutable_appearance/s_store_overlay = worn_item.build_worn_icon(default_layer = SUIT_STORE_LAYER, default_icon_file = 'icons/mob/clothing/belt_mirror.dmi')
if(OFFSET_S_STORE in dna.species.offset_features)
s_store_overlay.pixel_x += dna.species.offset_features[OFFSET_S_STORE][1]
s_store_overlay.pixel_y += dna.species.offset_features[OFFSET_S_STORE][2]
Expand All @@ -370,17 +359,16 @@ There are several things that need to be remembered:

if(head)
var/obj/item/worn_item = head
var/mutable_appearance/head_overlay
update_hud_head(worn_item)
var/icon_file

if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_HEAD)
return

var/icon_file
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/head/default.dmi'

head_overlay = head.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = icon_file)

if(!head_overlay)
return
var/mutable_appearance/head_overlay = head.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = icon_file)
if(OFFSET_HEAD in dna.species.offset_features)
head_overlay.pixel_x += dna.species.offset_features[OFFSET_HEAD][1]
head_overlay.pixel_y += dna.species.offset_features[OFFSET_HEAD][2]
Expand All @@ -398,17 +386,16 @@ There are several things that need to be remembered:

if(belt)
var/obj/item/worn_item = belt
var/mutable_appearance/belt_overlay
update_hud_belt(worn_item)
var/icon_file

if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_BELT)
return

var/icon_file
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/belt.dmi'

belt_overlay = belt.build_worn_icon(default_layer = BELT_LAYER, default_icon_file = icon_file)

if(!belt_overlay)
return
var/mutable_appearance/belt_overlay = belt.build_worn_icon(default_layer = BELT_LAYER, default_icon_file = icon_file)
if(OFFSET_BELT in dna.species.offset_features)
belt_overlay.pixel_x += dna.species.offset_features[OFFSET_BELT][1]
belt_overlay.pixel_y += dna.species.offset_features[OFFSET_BELT][2]
Expand All @@ -425,7 +412,6 @@ There are several things that need to be remembered:

if(wear_suit)
var/obj/item/worn_item = wear_suit
var/mutable_appearance/suit_overlay
update_hud_wear_suit(worn_item)
var/icon_file

Expand All @@ -438,10 +424,7 @@ There are several things that need to be remembered:
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = DEFAULT_SUIT_FILE

suit_overlay = wear_suit.build_worn_icon(default_layer = SUIT_LAYER, default_icon_file = icon_file)

if(!suit_overlay)
return
var/mutable_appearance/suit_overlay = wear_suit.build_worn_icon(default_layer = SUIT_LAYER, default_icon_file = icon_file)
if(OFFSET_SUIT in dna.species.offset_features)
suit_overlay.pixel_x += dna.species.offset_features[OFFSET_SUIT][1]
suit_overlay.pixel_y += dna.species.offset_features[OFFSET_SUIT][2]
Expand Down Expand Up @@ -486,18 +469,15 @@ There are several things that need to be remembered:
if(wear_mask)
var/obj/item/worn_item = wear_mask
update_hud_wear_mask(worn_item)
var/mutable_appearance/mask_overlay
var/icon_file = 'icons/mob/clothing/mask.dmi'

if(!(ITEM_SLOT_MASK & check_obscured_slots()))

if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/mask.dmi'
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_MASK)
return

mask_overlay = wear_mask.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = icon_file)
var/icon_file = 'icons/mob/clothing/mask.dmi'
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/mask.dmi'

if(!mask_overlay)
return
var/mutable_appearance/mask_overlay = wear_mask.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = icon_file)
if(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]
Expand Down
2 changes: 1 addition & 1 deletion code/modules/unit_tests/inhands.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// additional_inhands_location is for downstream modularity support. as an example, for skyrat's usage, set additional_inhands_location = "modular_skyrat/master_files/icons/mob/inhands/"
/// Make sure this location is also present in tools/deploy.sh
/// If you need additional paths ontop of this second one, you can add another generate_possible_icon_states_list("your/folder/path/inhands/") below the if(additional_inhands_location) block in Run(), and make sure to add that path to tools/deploy.sh as well.
var/additional_inhands_location = null
var/additional_inhands_location = "maplestation_modules/" // NON-MODULE CHANGE

/datum/unit_test/defined_inhand_icon_states/proc/generate_possible_icon_states_list(directory_path)
if(!directory_path)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
inhand_icon_state = "nobledress"
supports_variations_flags = CLOTHING_NO_VARIATION
body_parts_covered = CHEST|GROIN|LEGS
flags_cover = HIDESHOES
flags_inv = HIDESHOES

/obj/item/clothing/shoes/noble
name = "fancy loafers"
Expand Down

0 comments on commit 8a56be0

Please sign in to comment.