Height and minor bodypart overlay refactor (#96570)

## About The Pull Request

### Main changes

Height is no longer applied in `apply_overlay`

There is now a proc titled `apply_height()` which is passed an
appearance and a body area, and handles either applying a filter or
adjusting the offset of the appearance up or down

`apply_height` is now called directly when applying item appearances
(ie, `update_worn_x`)
`apply_height` is also called directly in `get_limb_icon` (as height is
included in limb render keys).

### Other changes

Bodypart overlays were cleaned up a bit. You can now apply and remove
bodypart overlays directly with just the typepath, which is a bit more
convenient.

Bodypart textures were split into a separate type. Previously, textures
relied on insertion order to be "correctly" added (any bodypart overlays
added later would not be modified by the bodypart texture). Now

Fixed a bug with cybernetics while I was there. They reskin by changing
DMI so they needed to have their DMI included in their render keys.

## Why It's Good For The Game

This allows us to be more specific and less wasteful about applying
height filters and whatnot - We can now specify whether certain overlays
are offset or given a filter.

For example: In the past, horns and frills were filtered solely because
they were attached to the head and the head was filtered.
We couldn't independently say "Offsets the horns and frills, they don't
need filters".
But now, not only are we able to say "rather than filter the head, just
apply an offset", we can also say "horns and frills should be offset
rather than filtered".

TL;DR fixes the issue where horns or cat ears are cut off by height
filters, yippee.

## Changelog

🆑 Melbert
fix: Cybernetic reskinning should break less. 
fix: Horns and cat ears should be cut off less by height.
fix: Bodypart textures should apply more consistently. 
refactor: Mutant parts like moth wings, lizard tails, cat eats, etc.
have been refactored a tiny bit, report any oddities.
refactor: Bodypart textures were refactored a tiny bit, report any
oddities.
refactor: Refactored the way height works, report anything weird looking
things involving that.
/🆑
This commit is contained in:
MrMelbert
2026-06-27 10:28:43 +02:00
committed by GitHub
parent a05270b364
commit 21ea64aec5
40 changed files with 371 additions and 309 deletions
+18 -26
View File
@@ -61,9 +61,9 @@
var/bonus_biotype
/// If the biotype was added - used to check if we should remove the biotype or not, on organ set loss.
var/biotype_added = FALSE
/// Limb overlay to apply upon activation
var/limb_overlay
/// Color priority for limb overlay
/// Limb texture to apply upon activation
var/limb_texture
/// Color priority for limb limb_texture
var/color_overlay_priority
/datum/status_effect/organ_set_bonus/proc/set_organs(new_value, obj/item/organ/organ)
@@ -97,22 +97,21 @@
if(bonus_activate_text)
to_chat(owner, bonus_activate_text)
// Add limb overlay
if(!iscarbon(owner) || !limb_overlay)
// Add limb texture
if(!limb_texture)
return TRUE
var/mob/living/carbon/carbon_owner = owner
RegisterSignal(carbon_owner, COMSIG_CARBON_ATTACH_LIMB, PROC_REF(texture_limb))
RegisterSignal(carbon_owner, COMSIG_CARBON_REMOVE_LIMB, PROC_REF(untexture_limb))
RegisterSignal(owner, COMSIG_CARBON_ATTACH_LIMB, PROC_REF(texture_limb))
RegisterSignal(owner, COMSIG_CARBON_REMOVE_LIMB, PROC_REF(untexture_limb))
for(var/obj/item/bodypart/limb as anything in carbon_owner.get_bodyparts())
for(var/obj/item/bodypart/limb as anything in owner.get_bodyparts())
if (!(limb.bodytype & BODYTYPE_ORGANIC))
continue
limb.add_bodypart_overlay(new limb_overlay(), update = FALSE)
limb.add_bodypart_texture(limb_texture, update = FALSE)
if (color_overlay_priority)
limb.add_color_override(COLOR_WHITE, color_overlay_priority)
carbon_owner.update_body()
owner.update_body()
return TRUE
/datum/status_effect/organ_set_bonus/proc/disable_bonus(obj/item/organ/removed_organ)
@@ -130,24 +129,20 @@
to_chat(owner, bonus_deactivate_text)
// Remove limb overlay
if(!iscarbon(owner) || !limb_overlay)
if(!limb_texture)
return
var/mob/living/carbon/carbon_owner = owner
UnregisterSignal(carbon_owner, list(COMSIG_CARBON_ATTACH_LIMB, COMSIG_CARBON_REMOVE_LIMB))
UnregisterSignal(owner, list(COMSIG_CARBON_ATTACH_LIMB, COMSIG_CARBON_REMOVE_LIMB))
if(QDELETED(carbon_owner))
if(QDELETED(owner))
return
for(var/obj/item/bodypart/limb as anything in carbon_owner.get_bodyparts())
var/overlay = locate(limb_overlay) in limb.bodypart_overlays
if(!overlay)
continue
limb.remove_bodypart_overlay(overlay, update = FALSE)
for(var/obj/item/bodypart/limb as anything in owner.get_bodyparts())
limb.remove_bodypart_texture(limb_texture, update = FALSE)
if (color_overlay_priority)
limb.remove_color_override(color_overlay_priority)
carbon_owner.update_body()
owner.update_body()
/datum/status_effect/organ_set_bonus/proc/texture_limb(atom/source, obj/item/bodypart/limb)
SIGNAL_HANDLER
@@ -156,16 +151,13 @@
return
// Not updating because enable/disable_bonus(obj/item/organ/removed_organ) call it down the line, and calls coming from comsigs update the owner's body themselves
limb.add_bodypart_overlay(new limb_overlay(), update = FALSE)
limb.add_bodypart_texture(limb_texture, update = FALSE)
if(color_overlay_priority)
limb.add_color_override(COLOR_WHITE, color_overlay_priority)
/datum/status_effect/organ_set_bonus/proc/untexture_limb(atom/source, obj/item/bodypart/limb)
SIGNAL_HANDLER
var/overlay = locate(limb_overlay) in limb.bodypart_overlays
if(!overlay)
return
limb.remove_bodypart_overlay(overlay, update = FALSE)
limb.remove_bodypart_texture(limb_texture, update = FALSE)
if(color_overlay_priority)
limb.remove_color_override(color_overlay_priority)