Files
Paradise/code/game/objects/items/dyeing.dm
Alan 392202d691 Add new sprites and coloring methods for basic jumpsuits. (#31568)
* Add new sprites and coloring methods for basic jumpsuits.

* Move palettes to dye_registry.dm. Add palette keys to jumpskirts.

* Add colored inhands, inventory sprites, icon and palette updates.

* Add jumpskirt item sprite.

* Add prisoner jumpsuit, psychedelic jumpsuit, random jumpskirt.
- Add new sprites for prisoner jumpsuits, skirts, and their rolldowns.
- Generate psychedelic jumpsuit icon in code, using colors it was originally composed of overlayed on the white jumpsuit.
- Add psychedelic jumpskirt, rolldowns, and inhands, since they are now easy to generate.
- Add a subtype for random jumpskirts patterned after random jumpsuits.
- Tweak orange color palette.
- Ensure randomized jumpsuits and skirts get the proper names and descriptions.

* Add dummy psychedelic suit sprites to satisfy linters.

* Attempt dyeing. Cleanup icon states. Update references.
- Moves jumpsuit coloring out of human_update_icons.dm to color.dm and updates dyeing.dm to hopefully enable dyeing. In the current state it only colors object sprites properly.
- Deletes icon states that will no longer be used for each solid color jumpsuit.
- Updates references to old icon states in datacore.dm, character.dm, and chameleon.dm to the white icon with a swapped palette where possible.

* Thanks, linters.

* Thanks, linters. part 2

* Fix dyeing. Add misc prison jumpsuit sprites.

* Dye chameleon jumpsuit when it mimics colored jumpsuit.

* Eliminate chameleon lag by caching jumpsuit icons.

* Add missing keyword args. Thanks, linters.

* Replace resistance flags in black jumpsuit.

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>

* Tweak jumpskirt shading on south humans and greys.

---------

Signed-off-by: Alan <alfalfascout@users.noreply.github.com>
2026-03-22 22:24:02 +00:00

97 lines
3.9 KiB
Plaintext

/**
* Updates an item's appearance to mimic the appearance of another item in the dye_registry's dictionary
* what types of items (beanie, jumpsuit, shoes, etc) src is dyed into depends on the dye_key unless an
* overidden dye_key is specified. For example if our dye_key is DYE_REGISTRY_UNDER and we specify to dye to
* DYE_RED, our item's appearance would then mimic /obj/item/clothing/under/color/red; see [code/_globalvars/lists/dye_registry.dm] for this dictionary
*
* once everything is updated, the target type path that we dyed the item into is returned
*
* Arguments:
* - dye_color: the DYE_COLOR specifies which dye color we look up to copy apearances from in the dye_registry; cannot be null
* - dye_key_override: this overrides the items `dyeing_key` which allows you to force the proc to use a specific lookup key for the dye_registry; this can be null
*/
/obj/item/proc/dye_item(dye_color, dye_key_override)
if(!dyeable || !dye_color)
return
var/dye_key_selector = dye_key_override ? dye_key_override : dyeing_key
if(!dye_key_selector)
return FALSE
if(!GLOB.dye_registry[dye_key_selector])
stack_trace("Item just tried to be dyed with an invalid registry key: [dye_key_selector]")
return FALSE
var/obj/item/target_type = GLOB.dye_registry[dye_key_selector][dye_color]
if(!target_type)
return FALSE
var/obj/item/target_obj = new target_type
// update icons
icon = initial(target_obj.icon)
icon_state = initial(target_obj.icon_state)
worn_icon = initial(target_obj.worn_icon)
worn_icon_state = initial(target_obj.worn_icon_state)
inhand_icon_state = initial(target_obj.inhand_icon_state)
sprite_sheets = target_obj.sprite_sheets
base_icon_state = target_obj.base_icon_state
// update inhand sprites
lefthand_file = initial(target_obj.lefthand_file)
righthand_file = initial(target_obj.righthand_file)
inhand_x_dimension = initial(target_obj.inhand_x_dimension)
inhand_y_dimension = initial(target_obj.inhand_y_dimension)
// update the name/description
name = initial(target_obj.name)
desc = target_obj.desc + "\nThe colors look a little dodgy."
qdel(target_obj)
update_appearance(ALL)
return target_type
/// Because of jumpsuit palettes, we have to do some extra icon shenanigans.
/obj/item/clothing/under/dye_item(dye_color, dye_key_override)
if(!dyeable || !dye_color)
return
var/dye_key_selector = dye_key_override ? dye_key_override : dyeing_key
var/obj/item/clothing/under/target_type = GLOB.dye_registry[dye_key_selector][dye_color]
// If we're dying it to a colored jumpsuit...
if(target_type in typesof(/obj/item/clothing/under/color))
var/obj/item/clothing/under/color/target_obj = new target_type(null)
set_icon_from_cache(palette_key = target_obj.icon_palette_key, dye_key = target_obj.dyeing_key)
// update the name/description
name = initial(target_obj.name)
desc = target_obj.desc + "\nThe colors look a little dodgy."
qdel(target_obj)
// If it also started as a colored jumpsuit, change the palette key
if("icon_palette_key" in vars)
var/obj/item/clothing/under/color/dyed_item = src
dyed_item.icon_palette_key = dye_color
return
// If we're not, but it started as a colored jumpsuit, unset the palette key so icon updates don't mess it up
else if("icon_palette_key" in vars)
var/obj/item/clothing/under/color/dyed_item = src
dyed_item.icon_palette_key = null
return ..()
/// Beanies use the color var for their appearance, we don't normally copy this over but we have to for beanies
/obj/item/clothing/head/beanie/dye_item(dye_color, dye_key_override)
. = ..()
if(.)
var/obj/item/target_type = .
color = initial(target_type.color)
/obj/item/clothing/mask/bandana/dye_item(dye_color, dye_key_override)
. = ..()
if(.)
var/obj/item/target_type = .
color = initial(target_type.color)
/obj/item/clothing/head/headscarf/dye_item(dye_color, dye_key_override)
. = ..()
if(.)
var/obj/item/target_type = .
color = initial(target_type.color)
worn_icon_state = worn_as + "_dyeable"