Files
MrMelbertandGitHub 62ad8d3520 Allows arbitrary/custom/"unlimited" bodypart overlay layers (#96684)
## About The Pull Request

`EXTERNAL_FRONT`, `EXTERNAL_ADJACENT`, and `EXTERNAL_BEHIND` are no
longer bitflags
Instead they are strings, that correspond to the sprite's icon state's
postfix ie `wings_FRONT` / `wings_ADJ`

Bodypart overlays now define their layers in terms of `postfix` to
`rendering layer`
For example wings are defined as:
```dm
	layers = list(
		EXTERNAL_FRONT = BODY_FRONT_LAYER,
		EXTERNAL_ADJACENT = BODY_ADJ_LAYER,
		EXTERNAL_BEHIND = BODY_BEHIND_LAYER,
	)
```
Which translates to
```dm
	layers = list(
		"FRONT" = 2.5,
		"ADJ" = 22.9,
		"BEHIND" = 32.2,
	)
```
## Why It's Good For The Game

What does this mean?

One, you are no longer constricted to the three existing layers when
adding a bodypart overlay. You can decide to put it on whatever layer
you need...
```dm
	layers = list(
		"FRONT" = 2.4, // I specifically need this to render above other front overlays!
	)
```

Two, you can easily add a new layer without needing to mess with core
bodypart code at all
```dm
	layers = list(
		"FRONT_HIGHER" = 2.4, // I need a special layer
		"FRONT" = 2.3, 
	)
```

Three, you don't have to use the `EXTERNAL_FRONT` `EXTERNAL_ADJACENT`
etc. at all if you don't want to. You can organize your layers however
you want...
```dm
	layers = list(
		// I can make my icon states `wings_top` and `wings_bottom` instead of `wings_FRONT` and `wings_BEHIND` to make it easier to parse
		"top" = BODY_ADJ_LAYER, 
		"bottom" = BODY_BEHIND_LAYER, 
	)
```

Ultimately, this makes it a ton easier to work with bodypart overlays,
as you no longer need to learn what FRONT/ADJ/BEHIND means. You can just
add your sprites and define your layers and you're done

## Changelog

🆑 Melbert
refactor: Surprise, a follow up refactor to species part rendering,
report any oddities with them (wings/snouts/tails/etc)
/🆑
2026-07-02 11:41:31 +02:00

37 lines
1.2 KiB
Plaintext

///Wing base type. doesn't really do anything
/obj/item/organ/wings
name = "wings"
desc = "Spread your wings and FLLLLLLLLYYYYY!"
zone = BODY_ZONE_CHEST
slot = ORGAN_SLOT_EXTERNAL_WINGS
use_mob_sprite_as_obj_sprite = TRUE
bodypart_overlay = /datum/bodypart_overlay/mutant/wings
organ_flags = parent_type::organ_flags | ORGAN_EXTERNAL
abstract_type = /obj/item/organ/wings
///Checks if the wings can soften short falls
/obj/item/organ/wings/proc/can_soften_fall()
return TRUE
///Implement as needed to play a sound effect on *flap emote
/obj/item/organ/wings/proc/make_flap_sound(mob/living/carbon/wing_owner)
return
///Bodypart overlay of default wings. Does not have any wing functionality
/datum/bodypart_overlay/mutant/wings
layers = list(
EXTERNAL_FRONT = BODY_FRONT_LAYER,
EXTERNAL_BEHIND = BODY_BEHIND_LAYER,
EXTERNAL_ADJACENT = BODY_ADJ_LAYER,
)
feature_key = FEATURE_WINGS
offset_location = ENTIRE_BODY
/// Slot we check against
var/slot_blocker = HIDEJUMPSUIT
/datum/bodypart_overlay/mutant/wings/can_draw_on_bodypart(obj/item/bodypart/bodypart_owner, mob/living/carbon/owner)
return ..() && !(bodypart_owner.owner?.obscured_slots & slot_blocker)