diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index 0b5bb13ad6e..a759f0381da 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -1499,4 +1499,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai /// Trait given when we escape into our shell #define TRAIT_SHELL_RETREATED "shell_retreated" + +/// Trait given to colorblind mobs +#define TRAIT_COLORBLIND "colorblind" + // END TRAIT DEFINES diff --git a/code/_globalvars/traits/_traits.dm b/code/_globalvars/traits/_traits.dm index 68b5a8af7c0..c97813539cf 100644 --- a/code/_globalvars/traits/_traits.dm +++ b/code/_globalvars/traits/_traits.dm @@ -213,6 +213,7 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_CLOWN_ENJOYER" = TRAIT_CLOWN_ENJOYER, "TRAIT_CLUMSY" = TRAIT_CLUMSY, "TRAIT_COAGULATING" = TRAIT_COAGULATING, + "TRAIT_COLORBLIND" = TRAIT_COLORBLIND, "TRAIT_COMBAT_MODE_LOCK" = TRAIT_COMBAT_MODE_LOCK, "TRAIT_CORPSELOCKED" = TRAIT_CORPSELOCKED, "TRAIT_CRITICAL_CONDITION" = TRAIT_CRITICAL_CONDITION, diff --git a/code/_globalvars/traits/admin_tooling.dm b/code/_globalvars/traits/admin_tooling.dm index 59566bcb035..d91fa87073d 100644 --- a/code/_globalvars/traits/admin_tooling.dm +++ b/code/_globalvars/traits/admin_tooling.dm @@ -74,6 +74,7 @@ GLOBAL_LIST_INIT(admin_visible_traits, list( "TRAIT_CLIFF_WALKER" = TRAIT_CLIFF_WALKER, "TRAIT_CLOWN_ENJOYER" = TRAIT_CLOWN_ENJOYER, "TRAIT_CLUMSY" = TRAIT_CLUMSY, + "TRAIT_COLORBLIND" = TRAIT_COLORBLIND, "TRAIT_COMMISSIONED" = TRAIT_COMMISSIONED, "TRAIT_CORPSELOCKED" = TRAIT_CORPSELOCKED, "TRAIT_CRITICAL_CONDITION" = TRAIT_CRITICAL_CONDITION, diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index a7e0eaf7b62..8e691572136 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -57,6 +57,27 @@ /// Lazy assoc list of refs to mobs to refs to photos they have studied for wires var/list/studied_photos + /// Assoc list of possible wire colors -> their greyscale variants + var/static/list/default_possible_colors = list( + "blue" = "dim grey", + "brown" = "dim grey", + "crimson" = "grey", + "cyan" = "light grey", + "gold" = "grey", + "green" = "grey", + "grey" = "grey", + "lime" = "light grey", + "magenta" = "grey", + "orange" = "grey", + "pink" = "grey", + "purple" = "grey", + "red" = "grey", + "silver" = "light grey", + "violet" = "grey", + "white" = "white", + "yellow" = "light grey", + ) + /datum/wires/New(atom/holder) ..() if(!istype(holder, holder_type)) @@ -103,26 +124,6 @@ qdel(src) /datum/wires/proc/randomize() - var/static/list/default_possible_colors = list( - "blue", - "brown", - "crimson", - "cyan", - "gold", - "green", - "grey", - "lime", - "magenta", - "orange", - "pink", - "purple", - "red", - "silver", - "violet", - "white", - "yellow", - ) - if(length(wires) > length(default_possible_colors)) stack_trace("Wire type [type] has more wires than possible colors, consider adding more colors or removing wires.") @@ -355,10 +356,12 @@ var/list/data = list() var/list/payload = list() var/reveal_wires = can_reveal_wires(user) + var/colorblind = HAS_TRAIT(user, TRAIT_COLORBLIND) for(var/color in colors) payload.Add(list(list( "color" = color, + "shownColor" = colorblind ? default_possible_colors[color] : color, "wire" = (((reveal_wires || always_reveal_wire(color)) && !is_dud_color(color)) ? get_wire(color) : null), "cut" = is_color_cut(color), "attached" = is_attached(color) diff --git a/code/game/objects/structures/signs/sign_eyechart.dm b/code/game/objects/structures/signs/sign_eyechart.dm index de0db7d0074..eb97d6f4fa8 100644 --- a/code/game/objects/structures/signs/sign_eyechart.dm +++ b/code/game/objects/structures/signs/sign_eyechart.dm @@ -28,13 +28,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/sign/eyechart, 32) . += span_warning("...But it's too dark to make out anything.") return - var/colorblind = FALSE - if(iscarbon(user)) - var/mob/living/carbon/carbon_user = user - colorblind = !!carbon_user.has_trauma_type(/datum/brain_trauma/mild/color_blindness) - else if(isdog(user) || iscat(user)) - colorblind = TRUE // i know these pets are not colorblind in the conventional sense, but it's an easter egg, ok? - + var/colorblind = HAS_TRAIT(user, TRAIT_COLORBLIND) var/obj/item/organ/eyes/eye = user.get_organ_slot(ORGAN_SLOT_EYES) // eye null checks here are for mobs without eyes. // humans missing eyes will be caught by the is_blind check above. diff --git a/code/modules/client/client_colour.dm b/code/modules/client/client_colour.dm index 2bee4dda956..524f24eb149 100644 --- a/code/modules/client/client_colour.dm +++ b/code/modules/client/client_colour.dm @@ -197,6 +197,16 @@ fade_in = 2 SECONDS fade_out = 2 SECONDS +/datum/client_colour/monochrome/New(mob/owner) + . = ..() + if (owner) + ADD_TRAIT(owner, TRAIT_COLORBLIND, type) + +/datum/client_colour/monochrome/Destroy() + if (owner) + REMOVE_TRAIT(owner, TRAIT_COLORBLIND, type) + return ..() + /datum/client_colour/monochrome/glasses priority = CLIENT_COLOR_GLASSES_PRIORITY diff --git a/code/modules/mob/living/basic/pets/cat/cat.dm b/code/modules/mob/living/basic/pets/cat/cat.dm index 5826a40ab4a..f3b9ce03b2c 100644 --- a/code/modules/mob/living/basic/pets/cat/cat.dm +++ b/code/modules/mob/living/basic/pets/cat/cat.dm @@ -92,7 +92,7 @@ AddElement(/datum/element/footstep, footstep_type = FOOTSTEP_MOB_CLAW) add_cell_sample() add_verb(src, /mob/living/proc/toggle_resting) - add_traits(list(TRAIT_CATLIKE_GRACE, TRAIT_VENTCRAWLER_ALWAYS, TRAIT_WOUND_LICKER), INNATE_TRAIT) + add_traits(list(TRAIT_CATLIKE_GRACE, TRAIT_VENTCRAWLER_ALWAYS, TRAIT_WOUND_LICKER, TRAIT_COLORBLIND), INNATE_TRAIT) ai_controller.set_blackboard_key(BB_HUNTABLE_PREY, typecacheof(huntable_items)) if(can_breed) add_breeding_component() diff --git a/code/modules/mob/living/basic/pets/dog/_dog.dm b/code/modules/mob/living/basic/pets/dog/_dog.dm index f3a106eb15c..3301753075a 100644 --- a/code/modules/mob/living/basic/pets/dog/_dog.dm +++ b/code/modules/mob/living/basic/pets/dog/_dog.dm @@ -67,6 +67,7 @@ AddElement(/datum/element/cultist_pet, pet_cult_icon_state = cult_icon_state) AddElement(/datum/element/wears_collar, collar_icon_state = collar_icon_state) ADD_TRAIT(src, TRAIT_WOUND_LICKER, INNATE_TRAIT) + ADD_TRAIT(src, TRAIT_COLORBLIND, INNATE_TRAIT) AddElement(/datum/element/pet_bonus, "woof") AddElement(/datum/element/footstep, FOOTSTEP_MOB_CLAW) AddElement(/datum/element/unfriend_attacker, untamed_reaction = "%SOURCE% fixes %TARGET% with a look of betrayal.") diff --git a/tgui/packages/tgui/interfaces/Wires.tsx b/tgui/packages/tgui/interfaces/Wires.tsx index a1ceba120e2..a7f5a850072 100644 --- a/tgui/packages/tgui/interfaces/Wires.tsx +++ b/tgui/packages/tgui/interfaces/Wires.tsx @@ -19,6 +19,7 @@ type Data = { type Wire = { color: string; + shownColor: string; cut: BooleanLike; attached: BooleanLike; wire: string; @@ -71,9 +72,9 @@ const WireMap = (props) => {