From a858885a7072378412ea4477bfdfe7e5b912cbe3 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Sat, 30 Aug 2025 05:06:38 +0200 Subject: [PATCH] Fixes nonhuman meat being unusable for any material crafting (#92722) ## About The Pull Request A ton of mobs don't have blood types so this runtimes constantly and would produce broken material datums. --- code/__HELPERS/colors.dm | 9 ++++----- code/datums/materials/meat.dm | 18 +++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code/__HELPERS/colors.dm b/code/__HELPERS/colors.dm index 8e9ac7def5b..6a5d6025fd4 100644 --- a/code/__HELPERS/colors.dm +++ b/code/__HELPERS/colors.dm @@ -173,11 +173,10 @@ saturation = min(saturation, 1 - added_saturation) var/list/new_matrix = list( - 0, 0, 0, 0, // Ignore original hue - 0, saturation, 0, 0, // Multiply the saturation by ours - 0, 0, 1 - deducted_light, 0, // If we're highly saturated then remove a bit of lightness to keep some color in - 0, 0, 0, 1, // Preserve alpha - hue, added_saturation, 0, 0, // And apply our preferred hue and some saturation if we're oversaturated + 0, 0, 0, // Ignore original hue + 0, saturation, 0, // Multiply the saturation by ours + 0, 0, 1 - deducted_light, // If we're highly saturated then remove a bit of lightness to keep some color in + hue, added_saturation, 0, // And apply our preferred hue and some saturation if we're oversaturated ) return color_matrix_filter(new_matrix, FILTER_COLOR_HSL) diff --git a/code/datums/materials/meat.dm b/code/datums/materials/meat.dm index 1937d6c0224..87f6318a64b 100644 --- a/code/datums/materials/meat.dm +++ b/code/datums/materials/meat.dm @@ -134,9 +134,10 @@ subjectname = source.name var/datum/blood_type/blood_type = source.get_bloodtype() - color = blood_type.get_color() - - blood_dna = source.get_blood_dna_list() + if (blood_type && blood_type.get_color() != BLOOD_COLOR_RED) + var/list/transition_filter = color_transition_filter(blood_type.get_color()) + color = transition_filter["color"] + blood_dna = source.get_blood_dna_list() if(ishuman(source)) var/mob/living/carbon/human/human_source = source @@ -155,8 +156,10 @@ if(source.exotic_bloodtype) var/datum/blood_type/blood_type = get_blood_type(source.exotic_bloodtype) - color = blood_type.get_color() - blood_dna = list("[blood_type.dna_string]" = blood_type) + if (blood_type && blood_type.get_color() != BLOOD_COLOR_RED) + var/list/transition_filter = color_transition_filter(blood_type.get_color()) + color = transition_filter["color"] + blood_dna = list("[blood_type.dna_string]" = blood_type) return ..() @@ -170,8 +173,9 @@ var/list/blood_data = source.data name = "[blood_data["real_name"] || "mystery"] [initial(name)]" var/datum/blood_type/blood_type = blood_data["blood_type"] - if(blood_type) - color = blood_type.get_color() + if(blood_type && blood_type.get_color() != BLOOD_COLOR_RED) + var/list/transition_filter = color_transition_filter(blood_type.get_color()) + color = transition_filter["color"] blood_dna = list("[blood_type.dna_string]" = blood_type) else color = source.color