From 7fa92cc4f417502cbf761677cc8b883d9271573a Mon Sep 17 00:00:00 2001 From: CliffracerX Date: Thu, 19 Sep 2024 18:31:15 -0400 Subject: [PATCH] fixing wing/tail previews & antennae regression --- .../preferences/antennae.dm | 29 +++++++++++++++++++ .../modular_customization/preferences/tail.dm | 29 ++++++++++++++++++- tgstation.dme | 1 + 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/modular_doppler/modular_customization/preferences/antennae.dm b/modular_doppler/modular_customization/preferences/antennae.dm index 714e2c8f88695..32c72a797779c 100644 --- a/modular_doppler/modular_customization/preferences/antennae.dm +++ b/modular_doppler/modular_customization/preferences/antennae.dm @@ -37,3 +37,32 @@ /datum/preference/choiced/moth_antennae/create_default_value() return /datum/sprite_accessory/moth_antennae/none::name + + + +/// Overwrite lives here +// Moth antennae have their own bespoke RGB code. +/datum/bodypart_overlay/mutant/antennae/color_image(image/overlay, draw_layer, obj/item/bodypart/limb) + if(limb == null) + return ..() + if(limb.owner == null) + return ..() + var/color_intended = COLOR_WHITE + + var/tcol_1 = limb.owner.dna.features["moth_antennae_1"] + var/tcol_2 = limb.owner.dna.features["moth_antennae_2"] + var/tcol_3 = limb.owner.dna.features["moth_antennae_3"] + if(tcol_1 && tcol_2 && tcol_3) + //this is beyond ugly but it works + var/r1 = hex2num(copytext(tcol_1, 2, 4)) / 255.0 + var/g1 = hex2num(copytext(tcol_1, 4, 6)) / 255.0 + var/b1 = hex2num(copytext(tcol_1, 6, 8)) / 255.0 + var/r2 = hex2num(copytext(tcol_2, 2, 4)) / 255.0 + var/g2 = hex2num(copytext(tcol_2, 4, 6)) / 255.0 + var/b2 = hex2num(copytext(tcol_2, 6, 8)) / 255.0 + var/r3 = hex2num(copytext(tcol_3, 2, 4)) / 255.0 + var/g3 = hex2num(copytext(tcol_3, 4, 6)) / 255.0 + var/b3 = hex2num(copytext(tcol_3, 6, 8)) / 255.0 + color_intended = list(r1,g1,b1, r2,g2,b2, r3,g3,b3) + overlay.color = color_intended + return overlay diff --git a/modular_doppler/modular_customization/preferences/tail.dm b/modular_doppler/modular_customization/preferences/tail.dm index 7d5020921b3d9..aead2b774c7b5 100644 --- a/modular_doppler/modular_customization/preferences/tail.dm +++ b/modular_doppler/modular_customization/preferences/tail.dm @@ -474,6 +474,10 @@ var/datum/sprite_accessory/chosen_tail = SSaccessories.tails_list_humanoid[value] return generate_back_icon(chosen_tail, "tail") +#define WIDTH_WINGS_FILE 45 +#define HEIGHT_WINGS_FILE 34 +#define WIDTH_BIGTAILS_FILE 64 +#define HEIGHT_BIGTAILS_FILE 32 /// Proc to gen that icon // We don't wanna copy paste this @@ -488,16 +492,39 @@ markings_icon_2.Blend(COLOR_VIBRANT_LIME, ICON_MULTIPLY) var/icon/markings_icon_3 = icon(sprite_accessory.icon, "m_[key]_[sprite_accessory.icon_state]_BEHIND_3", NORTH) markings_icon_3.Blend(COLOR_BLUE, ICON_MULTIPLY) + // A couple icon files use this plus-size setup; autocrop to generate better icons where possible + if(markings_icon_1.Width() == WIDTH_WINGS_FILE && markings_icon_1.Height() == HEIGHT_WINGS_FILE) + markings_icon_1.Crop(8, 2, 39, 33) + markings_icon_2.Crop(8, 2, 39, 33) + markings_icon_3.Crop(8, 2, 39, 33) + if(markings_icon_1.Width() == WIDTH_BIGTAILS_FILE && markings_icon_1.Height() == HEIGHT_BIGTAILS_FILE) // Plus-size tail files are simpler + markings_icon_1.Crop(17, 1, 48, 32) + markings_icon_2.Crop(17, 1, 48, 32) + markings_icon_3.Crop(17, 1, 48, 32) + // finally apply icons + markings_icon_1.Blend(final_icon, ICON_OVERLAY) + markings_icon_2.Blend(final_icon, ICON_OVERLAY) + markings_icon_3.Blend(final_icon, ICON_OVERLAY) final_icon.Blend(markings_icon_1, ICON_OVERLAY) final_icon.Blend(markings_icon_2, ICON_OVERLAY) final_icon.Blend(markings_icon_3, ICON_OVERLAY) - // front breaker + /// == front breaker == var/icon/markings_icon_1_f = icon(sprite_accessory.icon, "m_[key]_[sprite_accessory.icon_state]_FRONT", NORTH) markings_icon_1_f.Blend(COLOR_RED, ICON_MULTIPLY) var/icon/markings_icon_2_f = icon(sprite_accessory.icon, "m_[key]_[sprite_accessory.icon_state]_FRONT_2", NORTH) markings_icon_2_f.Blend(COLOR_VIBRANT_LIME, ICON_MULTIPLY) var/icon/markings_icon_3_f = icon(sprite_accessory.icon, "m_[key]_[sprite_accessory.icon_state]_FRONT_3", NORTH) markings_icon_3_f.Blend(COLOR_BLUE, ICON_MULTIPLY) + // A couple icon files use this plus-size setup; autocrop to generate better icons where possible + if(markings_icon_1_f.Width() == WIDTH_WINGS_FILE && markings_icon_1_f.Height() == HEIGHT_WINGS_FILE) + markings_icon_1_f.Crop(8, 2, 39, 33) + markings_icon_2_f.Crop(8, 2, 39, 33) + markings_icon_3_f.Crop(8, 2, 39, 33) + else if(markings_icon_1_f.Width() == WIDTH_BIGTAILS_FILE && markings_icon_1_f.Height() == HEIGHT_BIGTAILS_FILE) // Plus-size tail files are simpler + markings_icon_1_f.Crop(17, 1, 48, 32) + markings_icon_2_f.Crop(17, 1, 48, 32) + markings_icon_3_f.Crop(17, 1, 48, 32) + // finally apply icons final_icon.Blend(markings_icon_1_f, ICON_OVERLAY) final_icon.Blend(markings_icon_2_f, ICON_OVERLAY) final_icon.Blend(markings_icon_3_f, ICON_OVERLAY) diff --git a/tgstation.dme b/tgstation.dme index 37be98304d06a..107c1313abdf0 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6677,6 +6677,7 @@ #include "modular_doppler\modular_customization\preferences\snout.dm" #include "modular_doppler\modular_customization\preferences\tail.dm" #include "modular_doppler\modular_customization\preferences\wings.dm" +#include "modular_doppler\modular_customization\tri_color\antennae.dm" #include "modular_doppler\modular_customization\tri_color\body_marking_lizard.dm" #include "modular_doppler\modular_customization\tri_color\body_marking_moth.dm" #include "modular_doppler\modular_customization\tri_color\cap.dm"