Refactors obscured (#92779)

## About The Pull Request

Fixes #85028

Obscured flags and covered flags are tracked on carbons, updated as
items are equipped and unequipped. It's that shrimple.

Closes #92760

Just removes the species exception checks for not making sense

Also refactors handcuffs / legcuffs removal. In all of these situations
they were hardcoded when they could easily just use an inventory proc to
work.

## Why It's Good For The Game

Stops a million excessive calls to `check_obscured_slots`

Makes obscured behavior more consistent

Makes obscured behavior easier to use

Cleans up human rendering (There was some cursed stuff before with
render item -> updated obscured -> update body -> cause side effects)

## Changelog

🆑 Melbert
del: Golems which somehow manage to grow wings and somehow manage to
equip something that covers their jumpsuit can no longer fly.
(Seriously, this will not affect anyone)
refactor: Refactored clothing obscurity entirely. Items should be a
loooot more consistent and what covers what, and should update a lot
snappier. As always, report any oddities, like mysteriously disappearing
articles of clothing, hair, or species parts
refactored: Refactored handcuffs and legcuffs a bit, report any odd
situations with cuffs like getting stuck restrained
/🆑
This commit is contained in:
MrMelbert
2025-09-07 09:24:34 +02:00
committed by GitHub
parent c6e0b5da33
commit 135a09182b
61 changed files with 279 additions and 492 deletions
+5 -30
View File
@@ -123,12 +123,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
dyable = TRUE
/datum/bodypart_overlay/mutant/horns/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if((human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR))
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEHAIR)
/datum/bodypart_overlay/mutant/horns/get_global_feature_list()
return SSaccessories.horns_list
@@ -155,12 +150,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
feature_key = FEATURE_FRILLS
/datum/bodypart_overlay/mutant/frills/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(!(human.head?.flags_inv & HIDEEARS))
return TRUE
return FALSE
return !(bodypart_owner.owner?.obscured_slots & HIDEEARS)
/datum/bodypart_overlay/mutant/frills/get_global_feature_list()
return SSaccessories.frills_list
@@ -189,12 +179,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
feature_key = FEATURE_SNOUT
/datum/bodypart_overlay/mutant/snout/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if((human.head?.flags_inv & HIDESNOUT) || (human.wear_mask?.flags_inv & HIDESNOUT))
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDESNOUT)
/datum/bodypart_overlay/mutant/snout/get_global_feature_list()
return SSaccessories.snouts_list
@@ -282,12 +267,7 @@ Unlike normal organs, we're actually inside a persons limbs at all times
return burnt ? burn_datum.icon_state : sprite_datum.icon_state
/datum/bodypart_overlay/mutant/antennae/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(!(human.head?.flags_inv & HIDEANTENNAE))
return TRUE
return FALSE
return !(bodypart_owner.owner?.obscured_slots & HIDEANTENNAE)
///The leafy hair of a podperson
/obj/item/organ/pod_hair
@@ -333,9 +313,4 @@ Unlike normal organs, we're actually inside a persons limbs at all times
overlay.color = null
/datum/bodypart_overlay/mutant/pod_hair/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if((human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR))
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEHAIR)
+1 -6
View File
@@ -38,12 +38,7 @@
return SSaccessories.spines_list
/datum/bodypart_overlay/mutant/spines/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(human.wear_suit?.flags_inv & HIDEJUMPSUIT)
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEJUMPSUIT)
/datum/bodypart_overlay/mutant/spines/set_dye_color(new_color, obj/item/organ/tail/organ)
var/obj/item/organ/tail/tail = organ?.owner.get_organ_slot(ORGAN_SLOT_EXTERNAL_TAIL)
+2 -12
View File
@@ -148,12 +148,7 @@
return "[wagging ? "wagging_" : ""][sprite_datum.icon_state]" //add the wagging tag if we be wagging
/datum/bodypart_overlay/mutant/tail/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(human.wear_suit?.flags_inv & HIDEJUMPSUIT)
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEJUMPSUIT)
/obj/item/organ/tail/cat
name = "tail"
@@ -283,12 +278,7 @@
return (!isnull(tail_spine_key) ? "[tail_spine_key]_" : "") + (wagging ? "wagging_" : "") + sprite_datum.icon_state // Select the wagging state if appropriate
/datum/bodypart_overlay/mutant/tail_spines/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(human.wear_suit?.flags_inv & HIDEJUMPSUIT)
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEJUMPSUIT)
/datum/bodypart_overlay/mutant/tail_spines/set_dye_color(new_color, obj/item/organ/organ)
dye_color = new_color //no update_body_parts() call, tail/set_dye_color will do it.
@@ -82,8 +82,8 @@
if(human.stat || human.body_position == LYING_DOWN || isnull(human.client))
return FALSE
//Jumpsuits have tail holes, so it makes sense they have wing holes too
if(!cant_hide && human.wear_suit && ((human.wear_suit.flags_inv & HIDEJUMPSUIT) && (!human.wear_suit.species_exception || !is_type_in_list(src, human.wear_suit.species_exception))))
to_chat(human, span_warning("Your suit blocks your wings from extending!"))
if(!cant_hide && (human.obscured_slots & HIDEJUMPSUIT))
to_chat(human, span_warning("Your clothing blocks your wings from extending!"))
return FALSE
var/turf/location = get_turf(human)
if(!location)
+2 -11
View File
@@ -54,11 +54,7 @@
return FALSE
if(owner.has_gravity())
return FALSE
if(ishuman(owner))
var/mob/living/carbon/human/human_owner = owner
if(human_owner.wear_suit?.flags_inv & HIDEMUTWINGS)
return FALSE //Can't fly with hidden wings
if(burnt)
if((owner.obscured_slots & HIDEMUTWINGS) || burnt)
return FALSE
var/datum/gas_mixture/current = owner.loc.return_air()
if(current && (current.return_pressure() >= ONE_ATMOSPHERE*0.85))
@@ -117,12 +113,7 @@
return SSaccessories.moth_wings_list
/datum/bodypart_overlay/mutant/wings/moth/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(human.wear_suit?.flags_inv & HIDEMUTWINGS)
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEMUTWINGS)
/datum/bodypart_overlay/mutant/wings/moth/get_base_icon_state()
return burnt ? burn_datum.icon_state : sprite_datum.icon_state
+1 -12
View File
@@ -25,15 +25,4 @@
feature_key = FEATURE_WINGS
/datum/bodypart_overlay/mutant/wings/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if(!human.wear_suit)
return TRUE
if(!(human.wear_suit.flags_inv & HIDEJUMPSUIT))
return TRUE
if(human.wear_suit.species_exception && is_type_in_list(src, human.wear_suit.species_exception))
return TRUE
return FALSE
return !(bodypart_owner.owner?.obscured_slots & HIDEJUMPSUIT)
@@ -178,12 +178,7 @@
return SSaccessories.ears_list
/datum/bodypart_overlay/mutant/cat_ears/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner)
var/mob/living/carbon/human/human = bodypart_owner.owner
if(!istype(human))
return TRUE
if((human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR))
return FALSE
return TRUE
return !(bodypart_owner.owner?.obscured_slots & HIDEHAIR)
/datum/bodypart_overlay/mutant/cat_ears/get_image(image_layer, obj/item/bodypart/limb)
var/mutable_appearance/base_ears = ..()
@@ -267,8 +267,7 @@
var/mutable_appearance/eye_right = mutable_appearance('icons/mob/human/human_face.dmi', "[eye_icon_state]_r", -EYES_LAYER, parent)
var/list/overlays = list(eye_left, eye_right)
var/obscured = parent.check_obscured_slots()
if(overlay_ignore_lighting && !(obscured & ITEM_SLOT_EYES))
if(overlay_ignore_lighting && !(parent.obscured_slots & HIDEEYES))
overlays += emissive_appearance(eye_left.icon, eye_left.icon_state, parent, -EYES_LAYER, alpha = eye_left.alpha)
overlays += emissive_appearance(eye_right.icon, eye_right.icon_state, parent, -EYES_LAYER, alpha = eye_right.alpha)