[MIRROR] Makes flags_inv better at actually hiding things when used on non-suit clothing [MDB IGNORE] (#18356)

* Makes `flags_inv` better at actually hiding things when used on non-suit clothing

* big diff

* fixes

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: tastyfish <crazychris32@gmail.com>
This commit is contained in:
SkyratBot
2023-01-09 14:01:12 -05:00
committed by GitHub
co-authored by MrMelbert tastyfish
parent b9eeb21a49
commit ce22bf5dc7
4 changed files with 99 additions and 100 deletions
+1 -1
View File
@@ -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"
@@ -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.
@@ -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(transparent_protection = TRUE) & ITEM_SLOT_ICLOTHING)
return
@@ -93,7 +93,6 @@ There are several things that need to be remembered:
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.
@@ -103,36 +102,35 @@ 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))
icon_file = uniform.worn_icon_digi || DIGITIGRADE_UNIFORM_FILE // SKYRAT EDIT CHANGE
//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))
icon_file = uniform.worn_icon_digi || DIGITIGRADE_UNIFORM_FILE // SKYRAT EDIT CHANGE
// SKYRAT EDIT ADDITION - birbs
else if(dna.species.bodytype & BODYTYPE_CUSTOM)
icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_UNIFORM, w_uniform)
// SKYRAT EDIT END
// SKYRAT EDIT ADDITION - birbs
else if(dna.species.bodytype & BODYTYPE_CUSTOM)
icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_UNIFORM, w_uniform)
// SKYRAT EDIT 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
//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
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,
taur_bodytype = uniform.gets_cropped_on_taurs && (dna.species.bodytype & BODYTYPE_TAUR), // SKYRAT EDIT ADDITION - Taur-friendly uniforms!
)
//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,
taur_bodytype = uniform.gets_cropped_on_taurs && (dna.species.bodytype & BODYTYPE_TAUR), // SKYRAT EDIT ADDITION - Taur-friendly uniforms!
)
if(!handled_by_bodytype && (OFFSET_UNIFORM in dna.species.offset_features)) // SKYRAT EDIT CHANGE
uniform_overlay?.pixel_x += dna.species.offset_features[OFFSET_UNIFORM][1]
@@ -191,11 +189,15 @@ 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)
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_GLOVES)
return
var/icon_file
// SKYRAT EDIT ADDITION
var/mutant_override = FALSE
if(dna.species.bodytype & BODYTYPE_CUSTOM)
@@ -207,10 +209,8 @@ There are several things that need to be remembered:
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, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
var/mutable_appearance/gloves_overlay = gloves.build_worn_icon(default_layer = GLOVES_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!gloves_overlay)
return
if(!mutant_override && (OFFSET_GLOVES in dna.species.offset_features)) // SKYRAT EDIT CHANGE
gloves_overlay.pixel_x += dna.species.offset_features[OFFSET_GLOVES][1]
gloves_overlay.pixel_y += dna.species.offset_features[OFFSET_GLOVES][2]
@@ -230,9 +230,13 @@ 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)
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_EYES)
return
var/icon_file
// SKYRAT EDIT ADDITION
var/mutant_override = FALSE
if(dna.species.bodytype & BODYTYPE_CUSTOM)
@@ -240,15 +244,12 @@ There are several things that need to be remembered:
if(icon_file)
mutant_override = TRUE
// SKYRAT EDIT END
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(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/eyes.dmi'
glasses_overlay = glasses.build_worn_icon(default_layer = GLASSES_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
var/mutable_appearance/glasses_overlay = glasses.build_worn_icon(default_layer = GLASSES_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!glasses_overlay)
return
if(!mutant_override && (OFFSET_GLASSES in dna.species.offset_features)) // SKYRAT EDIT CHANGE
glasses_overlay.pixel_x += dna.species.offset_features[OFFSET_GLASSES][1]
glasses_overlay.pixel_y += dna.species.offset_features[OFFSET_GLASSES][2]
@@ -268,9 +269,11 @@ 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)
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_EARS)
return
var/icon_file
// SKYRAT EDIT ADDITION
@@ -281,13 +284,11 @@ There are several things that need to be remembered:
mutant_override = TRUE
// SKYRAT EDIT END
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
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, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
var/mutable_appearance/ears_overlay = ears.build_worn_icon(default_layer = EARS_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!ears_overlay)
return
if(!mutant_override && (OFFSET_EARS in dna.species.offset_features)) // SKYRAT EDIT CHANGE
ears_overlay.pixel_x += dna.species.offset_features[OFFSET_EARS][1]
ears_overlay.pixel_y += dna.species.offset_features[OFFSET_EARS][2]
@@ -304,29 +305,29 @@ 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
// SKYRAT EDIT ADDITION
var/mutant_override = FALSE
if(dna.species.bodytype & BODYTYPE_CUSTOM)
icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_NECK, wear_neck)
if(icon_file)
mutant_override = TRUE
// SKYRAT EDIT END
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_NECK)
return
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/neck.dmi'
var/icon_file
neck_overlay = worn_item.build_worn_icon(default_layer = NECK_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
// SKYRAT EDIT ADDITION
var/mutant_override = FALSE
if(dna.species.bodytype & BODYTYPE_CUSTOM)
icon_file = dna.species.generate_custom_worn_icon(LOADOUT_ITEM_NECK, wear_neck)
if(icon_file)
mutant_override = TRUE
// SKYRAT EDIT END
if(!neck_overlay)
return
if(!mutant_override && (OFFSET_NECK in dna.species.offset_features)) // SKYRAT EDIT CHANGE
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(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = 'icons/mob/clothing/neck.dmi'
var/mutable_appearance/neck_overlay = worn_item.build_worn_icon(default_layer = NECK_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!mutant_override && (OFFSET_NECK in dna.species.offset_features)) // SKYRAT EDIT CHANGE
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)
@@ -342,10 +343,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
var/mutant_override = FALSE // SKYRAT EDIT ADDITION
if((dna.species.bodytype & BODYTYPE_DIGITIGRADE) && (worn_item.supports_variations_flags & CLOTHING_DIGITIGRADE_VARIATION))
@@ -362,13 +365,11 @@ There are several things that need to be remembered:
return // We just don't want shoes that float if we're not displaying legs (useful for taurs, for now)
// SKYRAT EDIT END
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
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, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
var/mutable_appearance/shoes_overlay = shoes.build_worn_icon(default_layer = SHOES_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!shoes_overlay)
return
if(!mutant_override && (OFFSET_SHOES in dna.species.offset_features)) // SKYRAT EDIT CHANGE
shoes_overlay.pixel_x += dna.species.offset_features[OFFSET_SHOES][1]
shoes_overlay.pixel_y += dna.species.offset_features[OFFSET_SHOES][2]
@@ -388,13 +389,13 @@ 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]
@@ -409,8 +410,11 @@ 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)
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_HEAD)
return
var/icon_file
// SKYRAT EDIT ADDITION - This needs to be refactored.
@@ -425,13 +429,11 @@ There are several things that need to be remembered:
mutant_override = TRUE
// SKYRAT EDIT END
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
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, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
var/mutable_appearance/head_overlay = head.build_worn_icon(default_layer = HEAD_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!head_overlay)
return
if(!mutant_override && (OFFSET_HEAD in dna.species.offset_features)) // SKYRAT EDIT CHANGE
head_overlay.pixel_x += dna.species.offset_features[OFFSET_HEAD][1]
head_overlay.pixel_y += dna.species.offset_features[OFFSET_HEAD][2]
@@ -449,8 +451,11 @@ 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)
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_BELT)
return
var/icon_file
// SKYRAT EDIT ADDITION
@@ -461,13 +466,11 @@ There are several things that need to be remembered:
mutant_override = TRUE
// SKYRAT EDIT END
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
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, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
var/mutable_appearance/belt_overlay = belt.build_worn_icon(default_layer = BELT_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!belt_overlay)
return
if(!mutant_override && (OFFSET_BELT in dna.species.offset_features)) // SKYRAT EDIT CHANGE
belt_overlay.pixel_x += dna.species.offset_features[OFFSET_BELT][1]
belt_overlay.pixel_y += dna.species.offset_features[OFFSET_BELT][2]
@@ -484,7 +487,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
@@ -502,7 +504,7 @@ There are several things that need to be remembered:
mutant_override = TRUE
// SKYRAT EDIT END
if(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
if(!icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item)))
icon_file = DEFAULT_SUIT_FILE
// SKYRAT EDIT ADDITION START - Taur-friendly suits!
@@ -510,10 +512,8 @@ There are several things that need to be remembered:
if(!istype(wear_suit))
worn_suit = null
// SKYRAT EDIT END
suit_overlay = wear_suit.build_worn_icon(default_layer = SUIT_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null, taur_bodytype = worn_suit?.gets_cropped_on_taurs && (dna.species.bodytype & BODYTYPE_TAUR)) // SKYRAT EDIT CHANGE - Mutant bodytypes and Taur-friendly suits!
var/mutable_appearance/suit_overlay = wear_suit.build_worn_icon(default_layer = SUIT_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null, taur_bodytype = worn_suit?.gets_cropped_on_taurs && (dna.species.bodytype & BODYTYPE_TAUR)) // SKYRAT EDIT CHANGE - Mutant bodytypes and Taur-friendly suits!
if(!suit_overlay)
return
if(!mutant_override && (OFFSET_UNIFORM in dna.species.offset_features)) // SKYRAT EDIT CHANGE
suit_overlay.pixel_x += dna.species.offset_features[OFFSET_SUIT][1]
suit_overlay.pixel_y += dna.species.offset_features[OFFSET_SUIT][2]
@@ -558,8 +558,11 @@ 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 // SKYRATE EDIT CHANGE - replace mask icon path with default null, which is standard for these procs
if(check_obscured_slots(transparent_protection = TRUE) & ITEM_SLOT_MASK)
return
var/icon_file
// SKYRAT EDIT ADDITION
var/mutant_override = FALSE
@@ -573,15 +576,11 @@ There are several things that need to be remembered:
mutant_override = TRUE
// SKYRAT EDIT END
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(!(icon_exists(icon_file, RESOLVE_ICON_STATE(worn_item))))
icon_file = 'icons/mob/clothing/mask.dmi'
var/mutable_appearance/mask_overlay = wear_mask.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
mask_overlay = wear_mask.build_worn_icon(default_layer = FACEMASK_LAYER, default_icon_file = icon_file, override_file = mutant_override ? icon_file : null) // SKYRAT EDIT CHANGE
if(!mask_overlay)
return
if(!mutant_override && (OFFSET_FACEMASK in dna.species.offset_features)) // SKYRAT EDIT CHANGE
mask_overlay.pixel_x += dna.species.offset_features[OFFSET_FACEMASK][1]
mask_overlay.pixel_y += dna.species.offset_features[OFFSET_FACEMASK][2]
@@ -601,7 +600,7 @@ There are several things that need to be remembered:
var/obj/item/worn_item = back
var/mutable_appearance/back_overlay
update_hud_back(worn_item)
var/icon_file = 'icons/mob/clothing/back.dmi'
var/icon_file
// SKYRAT EDIT ADDITION
var/mutant_override = FALSE
Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 883 B