From 5e780064c12df4490b4723d9567e30fb74cdf420 Mon Sep 17 00:00:00 2001 From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com> Date: Sat, 17 Oct 2020 19:47:46 +0100 Subject: [PATCH] fixes and a toggle --- code/__DEFINES/citadel_defines.dm | 6 +- code/modules/client/preferences.dm | 92 +++++++++++-------- code/modules/client/preferences_savefile.dm | 15 +-- .../mob/living/carbon/human/species.dm | 15 +-- 4 files changed, 65 insertions(+), 63 deletions(-) diff --git a/code/__DEFINES/citadel_defines.dm b/code/__DEFINES/citadel_defines.dm index 89e44fc215..541b50e9bd 100644 --- a/code/__DEFINES/citadel_defines.dm +++ b/code/__DEFINES/citadel_defines.dm @@ -123,4 +123,8 @@ #define MATRIX_RED_BLUE "red_blue" #define MATRIX_GREEN_BLUE "green_blue" #define MATRIX_ALL "red_green_blue" -#define MATRIX_NONE "none" \ No newline at end of file +#define MATRIX_NONE "none" + +//defines for the two colour schemes, advanced and old +#define OLD_CHARACTER_COLORING "old_color_system" +#define ADVANCED_CHARACTER_COLORING "advanced_color_system" diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 2d2f6e1e00..a804dfacd2 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -166,7 +166,8 @@ GLOBAL_LIST_EMPTY(preferences_datums) "ooc_notes" = "", "meat_type" = "Mammalian", "body_model" = MALE, - "body_size" = RESIZE_DEFAULT_SIZE + "body_size" = RESIZE_DEFAULT_SIZE, + "color_scheme" = OLD_CHARACTER_COLORING ) var/custom_speech_verb = "default" //if your say_mod is to be something other than your races var/custom_tongue = "default" //if your tongue is to be something other than your races @@ -470,6 +471,9 @@ GLOBAL_LIST_EMPTY(preferences_datums) if(!use_skintones) dat += APPEARANCE_CATEGORY_COLUMN + dat += "

Advanced Coloring

" + dat += "[(features["color_scheme"] == ADVANCED_CHARACTER_COLORING) ? "Enabled" : "Disabled"]" + dat += "

Body Colors

" dat += "Primary Color:
" @@ -553,45 +557,46 @@ GLOBAL_LIST_EMPTY(preferences_datums) if(color_type) dat += "    Change
" else - //is it matrixed or does it have extra parts to be coloured? - var/find_part = features[mutant_part] || pref_species.mutant_bodyparts[mutant_part] - var/find_part_list = GLOB.mutant_reference_list[mutant_part] - if(find_part && find_part_list) - var/datum/sprite_accessory/accessory = find_part_list[find_part] - if(accessory) - if(accessory.color_src == MATRIXED || accessory.color_src == MUTCOLORS || accessory.color_src == MUTCOLORS2 || accessory.color_src == MUTCOLORS3) //mutcolors1-3 are deprecated now, please don't rely on these in the future - var/primary_feature = "[mutant_part]_primary" - var/secondary_feature = "[mutant_part]_secondary" - var/tertiary_feature = "[mutant_part]_tertiary" - var/matrixed_sections = accessory.matrixed_sections - if(accessory.color_src == MATRIXED && !matrixed_sections) - message_admins("Sprite Accessory Failure (customization): Accessory [accessory.type] is a matrixed item without any matrixed sections set!") - continue - else if(accessory.color_src == MATRIXED) - switch(matrixed_sections) - if(MATRIX_GREEN) //only composed of a green section - primary_feature = secondary_feature //swap primary for secondary, so it properly assigns the second colour, reserved for the green section - if(MATRIX_BLUE) - primary_feature = tertiary_feature //same as above, but the tertiary feature is for the blue section - if(MATRIX_RED_BLUE) //composed of a red and blue section - secondary_feature = tertiary_feature //swap secondary for tertiary, as blue should always be tertiary - if(MATRIX_GREEN_BLUE) //composed of a green and blue section - primary_feature = secondary_feature //swap primary for secondary, as first option is green, which is linked to the secondary - secondary_feature = tertiary_feature //swap secondary for tertiary, as second option is blue, which is linked to the tertiary - if(!features[primary_feature]) - features[primary_feature] = "FFFFFF" - dat += "Primary Color
" - dat += "    Change
" - if((accessory.color_src == MATRIXED && (matrixed_sections == MATRIX_RED_BLUE || matrixed_sections == MATRIX_GREEN_BLUE || matrixed_sections == MATRIX_RED_GREEN || matrixed_sections == MATRIX_ALL)) || (accessory.extra && (accessory.extra_color_src == MUTCOLORS || accessory.extra_color_src == MUTCOLORS2 || accessory.extra_color_src == MUTCOLORS3))) - if(!features[secondary_feature]) - features[secondary_feature] = "FFFFFF" - dat += "Secondary Color
" - dat += "    Change
" - if((accessory.color_src == MATRIXED && matrixed_sections == MATRIX_ALL) || (accessory.extra2 && (accessory.extra2_color_src == MUTCOLORS || accessory.extra2_color_src == MUTCOLORS2 || accessory.extra2_color_src == MUTCOLORS3))) - if(!features[tertiary_feature]) - features[tertiary_feature] = "FFFFFF" - dat += "Tertiary Color
" - dat += "    Change
" + if(features["color_scheme"] == ADVANCED_CHARACTER_COLORING) //advanced individual part colouring system + //is it matrixed or does it have extra parts to be coloured? + var/find_part = features[mutant_part] || pref_species.mutant_bodyparts[mutant_part] + var/find_part_list = GLOB.mutant_reference_list[mutant_part] + if(find_part && find_part_list) + var/datum/sprite_accessory/accessory = find_part_list[find_part] + if(accessory) + if(accessory.color_src == MATRIXED || accessory.color_src == MUTCOLORS || accessory.color_src == MUTCOLORS2 || accessory.color_src == MUTCOLORS3) //mutcolors1-3 are deprecated now, please don't rely on these in the future + var/primary_feature = "[mutant_part]_primary" + var/secondary_feature = "[mutant_part]_secondary" + var/tertiary_feature = "[mutant_part]_tertiary" + var/matrixed_sections = accessory.matrixed_sections + if(accessory.color_src == MATRIXED && !matrixed_sections) + message_admins("Sprite Accessory Failure (customization): Accessory [accessory.type] is a matrixed item without any matrixed sections set!") + continue + else if(accessory.color_src == MATRIXED) + switch(matrixed_sections) + if(MATRIX_GREEN) //only composed of a green section + primary_feature = secondary_feature //swap primary for secondary, so it properly assigns the second colour, reserved for the green section + if(MATRIX_BLUE) + primary_feature = tertiary_feature //same as above, but the tertiary feature is for the blue section + if(MATRIX_RED_BLUE) //composed of a red and blue section + secondary_feature = tertiary_feature //swap secondary for tertiary, as blue should always be tertiary + if(MATRIX_GREEN_BLUE) //composed of a green and blue section + primary_feature = secondary_feature //swap primary for secondary, as first option is green, which is linked to the secondary + secondary_feature = tertiary_feature //swap secondary for tertiary, as second option is blue, which is linked to the tertiary + if(!features[primary_feature]) + features[primary_feature] = "FFFFFF" + dat += "Primary Color
" + dat += "    Change
" + if((accessory.color_src == MATRIXED && (matrixed_sections == MATRIX_RED_BLUE || matrixed_sections == MATRIX_GREEN_BLUE || matrixed_sections == MATRIX_RED_GREEN || matrixed_sections == MATRIX_ALL)) || (accessory.extra && (accessory.extra_color_src == MUTCOLORS || accessory.extra_color_src == MUTCOLORS2 || accessory.extra_color_src == MUTCOLORS3))) + if(!features[secondary_feature]) + features[secondary_feature] = "FFFFFF" + dat += "Secondary Color
" + dat += "    Change
" + if((accessory.color_src == MATRIXED && matrixed_sections == MATRIX_ALL) || (accessory.extra2 && (accessory.extra2_color_src == MUTCOLORS || accessory.extra2_color_src == MUTCOLORS2 || accessory.extra2_color_src == MUTCOLORS3))) + if(!features[tertiary_feature]) + features[tertiary_feature] = "FFFFFF" + dat += "Tertiary Color
" + dat += "    Change
" mutant_category++ if(mutant_category >= MAX_MUTANT_ROWS) @@ -2091,6 +2096,13 @@ GLOBAL_LIST_EMPTY(preferences_datums) else to_chat(user,"Invalid color. Your color is not bright enough.") + //advanced color mode toggle + if("color_scheme") + if(features["color_scheme"] == ADVANCED_CHARACTER_COLORING) + features["color_scheme"] = OLD_CHARACTER_COLORING + else + features["color_scheme"] = ADVANCED_CHARACTER_COLORING + //Genital code if("cock_color") var/new_cockcolor = input(user, "Penis color:", "Character Preference","#"+features["cock_color"]) as color|null diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 7d5af1ff81..4dda3323ab 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -239,18 +239,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car var/primary_string = "[feature_type]_primary" var/secondary_string = "[feature_type]_secondary]" var/tertiary_string = "[feature_type]_tertiary]" - if(accessory.matrixed_sections) - switch(accessory.matrixed_sections) - if(MATRIX_GREEN) //only composed of a green section - primary_string = secondary_string //swap primary for secondary, so it properly assigns the second colour, reserved for the green section - if(MATRIX_BLUE) - primary_string = tertiary_string //same as above, but the tertiary feature is for the blue section - if(MATRIX_RED_BLUE) //composed of a red and blue section - secondary_string = tertiary_string //swap secondary for tertiary, as blue should always be tertiary - if(MATRIX_GREEN_BLUE) //composed of a green and blue section - primary_string = secondary_string //swap primary for secondary, as first option is green, which is linked to the secondary - secondary_string = tertiary_string //swap secondary for tertiary, as second option is blue, which is linked to the tertiary - else if(accessory.color_src != MATRIXED) + if(accessory.color_src == MATRIXED && !accessory.matrixed_sections) message_admins("Sprite Accessory Failure (migration from [current_version] to 39): Accessory [accessory.type] is a matrixed item without any matrixed sections set!") continue if(accessory.color_src == MATRIXED) @@ -264,6 +253,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car else if(accessory.color_src == MUTCOLORS3) features[tertiary_string] = features["mcolor3"] + features["color_scheme"] = OLD_CHARACTER_COLORING //advanced is off + /datum/preferences/proc/load_path(ckey,filename="preferences.sav") if(!ckey) return diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm index 2ec5b84cb9..2ce5e74c56 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -746,14 +746,7 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) ) var/g = (H.dna.features["body_model"] == FEMALE) ? "f" : "m" - var/list/colorlist = list() var/husk = HAS_TRAIT(H, TRAIT_HUSK) - colorlist += husk ? ReadRGB("#a3a3a3") : ReadRGB("[H.dna.features["mcolor"]]00") - colorlist += husk ? ReadRGB("#a3a3a3") : ReadRGB("[H.dna.features["mcolor2"]]00") - colorlist += husk ? ReadRGB("#a3a3a3") : ReadRGB("[H.dna.features["mcolor3"]]00") - colorlist += husk ? list(0, 0, 0) : list(0, 0, 0, hair_alpha) - for(var/index in 1 to colorlist.len) - colorlist[index] /= 255 for(var/layer in relevant_layers) var/list/standing = list() @@ -775,9 +768,11 @@ GLOBAL_LIST_EMPTY(roundstart_race_names) if(S.center) accessory_overlay = center_image(accessory_overlay, S.dimension_x, S.dimension_y) - var/primary_string = "[S.mutant_part_string]_primary" - var/secondary_string = "[S.mutant_part_string]_secondary" - var/tertiary_string = "[S.mutant_part_string]_tertiary" + var/advanced_color_system = (H.dna.features["color_scheme"] == ADVANCED_CHARACTER_COLORING) + + var/primary_string = advanced_color_system ? "[S.mutant_part_string]_primary" : "mcolor" + var/secondary_string = advanced_color_system ? "[S.mutant_part_string]_secondary" : "mcolor2" + var/tertiary_string = advanced_color_system ? "[S.mutant_part_string]_tertiary" : "mcolor3" if(!husk) if(!forced_colour)