mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## About The Pull Request MODsuit modules now render on the part they're attached to, that being first part if required_slots is set, otherwise defaulting to the control module. Instead of using icon ops and a cache, module masking (used by armor boosters and insignias) will instead render the module on all parts, each overlay alpha filtered using the worn piece as the mask. To do this we also migrate modules to separate_worn_overlays, which fixes the issue where they'd always get painted the same color as the back piece, ignoring use_mod_colors's value (which is FALSE by default). So now modules that inherit MOD's color like armor booster will be painted accordingly to their piece. This also means that modules actually layer properly, and don't go ontop of items that they should be under. Additionally, whenever gloves or boots overslot an item, the overslotted item will still render underneath them if they're unsealed. Because it looks weird when your gloves disappear when you extend your MODsuit ones.  Look at that hip look, she'd have bare hands and ankles without this PR. Closes #90370 ## Why It's Good For The Game Fixes a bunch of visual jank that looks weird, and overslotting displaying overslotted item is just behavior you'd expect normally. ## Changelog 🆑 add: When a MODsuit piece overslots an item, it will now render beneath that piece as long as its unsealed. refactor: Refactored how MODsuit modules are rendered, report any bugs on GitHub! /🆑
47 lines
1.6 KiB
Plaintext
47 lines
1.6 KiB
Plaintext
/// Datum to handle interactions between a MODsuit and its parts.
|
|
/datum/mod_part
|
|
/// The actual item we handle.
|
|
var/obj/item/part_item = null
|
|
/// Are we sealed?
|
|
var/sealed = FALSE
|
|
/// Message to user when unsealed.
|
|
var/unsealed_message
|
|
/// Message to user when sealed.
|
|
var/sealed_message
|
|
/// The layer the item will render on when unsealed.
|
|
var/unsealed_layer
|
|
/// The layer the item will render on when sealed.
|
|
var/sealed_layer
|
|
/// Can our part overslot over others?
|
|
var/can_overslot = FALSE
|
|
/// What are we overslotting over?
|
|
var/obj/item/overslotting = null
|
|
|
|
/datum/mod_part/Destroy()
|
|
// To avoid qdel loops in MOD control units, since they're also a part
|
|
if (!QDELING(part_item))
|
|
qdel(part_item)
|
|
part_item = null
|
|
overslotting = null
|
|
return ..()
|
|
|
|
/datum/mod_part/proc/set_item(obj/item/new_part)
|
|
part_item = new_part
|
|
RegisterSignal(part_item, COMSIG_ITEM_GET_SEPARATE_WORN_OVERLAYS, PROC_REF(get_separate_worn_overlays))
|
|
|
|
// If we're overslotting an item, add its visual as an underlay
|
|
/datum/mod_part/proc/get_separate_worn_overlays(obj/item/source, list/overlays, mutable_appearance/standing, mutable_appearance/draw_target, isinhands, icon_file)
|
|
SIGNAL_HANDLER
|
|
|
|
if (!overslotting || sealed)
|
|
return
|
|
|
|
var/checked_slot = source.slot_flags
|
|
if (ismob(source.loc))
|
|
var/mob/as_mob = source.loc
|
|
checked_slot = as_mob.get_slot_by_item(source)
|
|
var/mutable_appearance/worn_overlay = overslotting.build_worn_icon(default_layer = -draw_target.layer + 0.1, default_icon_file = get_default_icon_by_slot(checked_slot))
|
|
for (var/mutable_appearance/overlay in worn_overlay.overlays)
|
|
overlay.layer = draw_target.layer + 0.1
|
|
overlays += worn_overlay
|