From 63ca34ccd29a3ddb57094f487fa0ff5f1f7894be Mon Sep 17 00:00:00 2001 From: Critawakets Date: Fri, 13 Dec 2024 02:45:19 -0500 Subject: [PATCH 1/2] Adds in the colorblind quirk. --- .../code/datums/quirks/neutral.dm | 75 +++++++++++++++++++ .../character_preferences/colorblind.tsx | 6 ++ 2 files changed, 81 insertions(+) create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/colorblind.tsx diff --git a/maplestation_modules/code/datums/quirks/neutral.dm b/maplestation_modules/code/datums/quirks/neutral.dm index 47b05d3ddb81..a755cc422cfe 100644 --- a/maplestation_modules/code/datums/quirks/neutral.dm +++ b/maplestation_modules/code/datums/quirks/neutral.dm @@ -122,3 +122,78 @@ sprint_regen_multiplier = new_sprint_regen quirk_human.sprint_length_max *= new_sprint_length quirk_human.sprint_regen_per_second *= new_sprint_regen + +#define COLORBLINDNESS_PROTANOPIA "Protanopia (Red-Green)" +#define COLORBLINDNESS_DEUTERANOPIA "Deuteranopia (Red-Green)" +#define COLORBLINDNESS_TRITANOPIA "Tritanopia (Blue-Yellow)" + +// Uses the same values as the colorblind test debug. As always, they're not accurate and if you argue about that or argue like it is accurate i will SLAP YOU +/datum/quirk/colorblind + name = "Colorblind" + desc = "You are partially colorblind and are unable to percieve the full color spectrum." + icon = FA_ICON_ADJUST + value = 0 + gain_text = span_notice("You suddenly can't see as many colors anymore.") + lose_text = span_danger("You can see the world in full color now! It's not that great...") + medical_record_text = "Patient is afflicted with color blindness." + var/colorblind_type = COLORBLINDNESS_DEUTERANOPIA //cached to prevent on-the-fly prefs switching causing issues + +/datum/quirk/colorblind/add(client/client_source) + colorblind_type = client_source?.prefs?.read_preference(/datum/preference/choiced/colorblindedness) + switch(colorblind_type) + if(COLORBLINDNESS_PROTANOPIA) + quirk_holder.add_client_colour(/datum/client_colour/colorblind/protanopia) + if(COLORBLINDNESS_DEUTERANOPIA) + quirk_holder.add_client_colour(/datum/client_colour/colorblind/deuteranopia) + if(COLORBLINDNESS_TRITANOPIA) + quirk_holder.add_client_colour(/datum/client_colour/colorblind/tritanopia) + +/datum/quirk/colorblind/remove() + switch(colorblind_type) + if(COLORBLINDNESS_PROTANOPIA) + quirk_holder.remove_client_colour(/datum/client_colour/colorblind/protanopia) + if(COLORBLINDNESS_DEUTERANOPIA) + quirk_holder.remove_client_colour(/datum/client_colour/colorblind/deuteranopia) + if(COLORBLINDNESS_TRITANOPIA) + quirk_holder.remove_client_colour(/datum/client_colour/colorblind/tritanopia) + +/datum/quirk_constant_data/colorblind + associated_typepath = /datum/quirk/colorblind + customization_options = list(/datum/preference/choiced/colorblindedness) + +/datum/preference/choiced/colorblindedness + category = PREFERENCE_CATEGORY_MANUALLY_RENDERED + savefile_key = "colorblindedness" + savefile_identifier = PREFERENCE_CHARACTER + can_randomize = FALSE + +/datum/preference/choiced/colorblindedness/create_default_value() + return COLORBLINDNESS_DEUTERANOPIA // most common type + +/datum/preference/choiced/colorblindedness/init_possible_values() + return list(COLORBLINDNESS_PROTANOPIA, COLORBLINDNESS_DEUTERANOPIA, COLORBLINDNESS_TRITANOPIA) + +/datum/preference/choiced/colorblindedness/is_accessible(datum/preferences/preferences) + if(!..(preferences)) + return FALSE + + return /datum/quirk/colorblind::name in preferences.all_quirks + +/datum/preference/choiced/colorblindedness/apply_to_human(mob/living/carbon/human/target, value) + return + +/datum/client_colour/colorblind + priority = 10 // PRIORITY_HIGH + +/datum/client_colour/colorblind/protanopia + colour = list(0.56,0.43,0,0, 0.55,0.44,0,0, 0,0.24,0.75,0, 0,0,0,1, 0,0,0,0) + +/datum/client_colour/colorblind/deuteranopia + colour = list(0.62,0.37,0,0, 0.70,0.30,0,0, 0,0.30,0.70,0, 0,0,0,1, 0,0,0,0) + +/datum/client_colour/colorblind/tritanopia + colour = list(0.95,0.5,0,0, 0,0.43,0.56,0, 0,0.47,0.52,0, 0,0,0,1, 0,0,0,0) + +#undef COLORBLINDNESS_PROTANOPIA +#undef COLORBLINDNESS_DEUTERANOPIA +#undef COLORBLINDNESS_TRITANOPIA diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/colorblind.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/colorblind.tsx new file mode 100644 index 000000000000..c4b412bd9bb7 --- /dev/null +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/character_preferences/colorblind.tsx @@ -0,0 +1,6 @@ +import { FeatureChoiced, FeatureDropdownInput } from '../base'; + +export const colorblindedness: FeatureChoiced = { + name: 'Colorblindness', + component: FeatureDropdownInput, +}; From ac6cb5af4d8d24d0bef315c5fbf2aaf2b522157b Mon Sep 17 00:00:00 2001 From: Critawakets Date: Fri, 13 Dec 2024 03:01:19 -0500 Subject: [PATCH 2/2] changes the quirk icon to one that isnt used --- maplestation_modules/code/datums/quirks/neutral.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maplestation_modules/code/datums/quirks/neutral.dm b/maplestation_modules/code/datums/quirks/neutral.dm index a755cc422cfe..9d1aa9574bac 100644 --- a/maplestation_modules/code/datums/quirks/neutral.dm +++ b/maplestation_modules/code/datums/quirks/neutral.dm @@ -131,7 +131,7 @@ /datum/quirk/colorblind name = "Colorblind" desc = "You are partially colorblind and are unable to percieve the full color spectrum." - icon = FA_ICON_ADJUST + icon = FA_ICON_PALETTE value = 0 gain_text = span_notice("You suddenly can't see as many colors anymore.") lose_text = span_danger("You can see the world in full color now! It's not that great...")