From 9a6b5a71f3cab7c862aa5aeb5c86305a31aecef3 Mon Sep 17 00:00:00 2001 From: Atermonera Date: Fri, 29 May 2020 23:05:22 -0700 Subject: [PATCH] Streamline (Facial) Hair & Marking Character Customization, Port color_square to Clean Prefcode --- .../preference_setup/general/03_body.dm | 122 ++++++++++-------- .../client/preference_setup/global/01_ui.dm | 4 +- .../preference_setup/preference_setup.dm | 6 +- .../client/preference_setup/vore/01_ears.dm | 12 +- .../mob/new_player/preferences_setup.dm | 28 ++++ html/changelogs/KasparoVv - PR - 7215.yml | 7 + 6 files changed, 119 insertions(+), 60 deletions(-) create mode 100644 html/changelogs/KasparoVv - PR - 7215.yml diff --git a/code/modules/client/preference_setup/general/03_body.dm b/code/modules/client/preference_setup/general/03_body.dm index 518e74be93..6ecbf3fbb1 100644 --- a/code/modules/client/preference_setup/general/03_body.dm +++ b/code/modules/client/preference_setup/general/03_body.dm @@ -316,33 +316,33 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O . += "Hair
" if(has_flag(mob_species, HAS_HAIR_COLOR)) - . += "Change Color
__
" - . += " Style: [pref.h_style]
" + . += "Change Color [color_square(pref.r_hair, pref.g_hair, pref.b_hair)] " + . += " Style: < > [pref.h_style]
" //The < & > in this line is correct-- those extra characters are the arrows you click to switch between styles. . += "
Facial
" if(has_flag(mob_species, HAS_HAIR_COLOR)) - . += "Change Color
__
" - . += " Style: [pref.f_style]
" + . += "Change Color [color_square(pref.r_facial, pref.g_facial, pref.b_facial)] " + . += " Style: < > [pref.f_style]
" //Same as above with the extra > & < characters if(has_flag(mob_species, HAS_EYE_COLOR)) . += "
Eyes
" - . += "Change Color
__

" + . += "Change Color [color_square(pref.r_eyes, pref.g_eyes, pref.b_eyes)]
" if(has_flag(mob_species, HAS_SKIN_COLOR)) . += "
Body Color
" - . += "Change Color
__

" + . += "Change Color [color_square(pref.r_skin, pref.g_skin, pref.b_skin)]
" . += "
Body Markings +
" + . += "" for(var/M in pref.body_markings) - . += "[M] [pref.body_markings.len > 1 ? "˄˅ " : ""]-Color" - . += "
__
" - . += "
" + . += "[M][pref.body_markings.len > 1 ? "˄ ˅ mv " : ""]- Color[color_square(hex = pref.body_markings[M])]" + . += "" . += "
" . += "Allow Synth markings: [pref.synth_markings ? "Yes" : "No"]
" . += "Allow Synth color: [pref.synth_color ? "Yes" : "No"]
" if(pref.synth_color) - . += "Change Color
__
" + . += "Change Color [color_square(pref.r_synth, pref.g_synth, pref.b_synth)]" . = jointext(.,null) @@ -403,16 +403,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O pref.set_biological_gender(mob_species.genders[1]) pref.custom_species = null //VOREStation Edit - This is cleared on species changes //grab one of the valid hair styles for the newly chosen species - var/list/valid_hairstyles = list() - for(var/hairstyle in hair_styles_list) - var/datum/sprite_accessory/S = hair_styles_list[hairstyle] - if(pref.biological_gender == MALE && S.gender == FEMALE) - continue - if(pref.biological_gender == FEMALE && S.gender == MALE) - continue - if(!(pref.species in S.species_allowed)) - continue - valid_hairstyles[hairstyle] = hair_styles_list[hairstyle] + var/list/valid_hairstyles = pref.get_valid_hairstyles() if(valid_hairstyles.len) pref.h_style = pick(valid_hairstyles) @@ -421,17 +412,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O pref.h_style = hair_styles_list["Bald"] //grab one of the valid facial hair styles for the newly chosen species - var/list/valid_facialhairstyles = list() - for(var/facialhairstyle in facial_hair_styles_list) - var/datum/sprite_accessory/S = facial_hair_styles_list[facialhairstyle] - if(pref.biological_gender == MALE && S.gender == FEMALE) - continue - if(pref.biological_gender == FEMALE && S.gender == MALE) - continue - if(!(pref.species in S.species_allowed)) - continue - - valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle] + var/list/valid_facialhairstyles = pref.get_valid_facialhairstyles() if(valid_facialhairstyles.len) pref.f_style = pick(valid_facialhairstyles) @@ -465,21 +446,35 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O return TOPIC_REFRESH_UPDATE_PREVIEW else if(href_list["hair_style"]) - var/list/valid_hairstyles = list() - for(var/hairstyle in hair_styles_list) - var/datum/sprite_accessory/S = hair_styles_list[hairstyle] - if(!(pref.species in S.species_allowed) && (!pref.custom_base || !(pref.custom_base in S.species_allowed))) //VOREStation Edit - Custom species base species allowance - continue - if((!S.ckeys_allowed) || (usr.ckey in S.ckeys_allowed)) //VOREStation Edit, allows ckey locked hairstyles. - valid_hairstyles[S.name] = hairstyle //VOREStation Edit, allows ckey locked hairstyles. - - //valid_hairstyles[hairstyle] = hair_styles_list[hairstyle] //VOREStation Edit. Replaced by above. + var/list/valid_hairstyles = pref.get_valid_hairstyles() var/new_h_style = input(user, "Choose your character's hair style:", "Character Preference", pref.h_style) as null|anything in valid_hairstyles if(new_h_style && CanUseTopic(user)) pref.h_style = new_h_style return TOPIC_REFRESH_UPDATE_PREVIEW + else if(href_list["hair_style_left"]) + var/H = href_list["hair_style_left"] + var/list/valid_hairstyles = pref.get_valid_hairstyles() + var/start = valid_hairstyles.Find(H) + + if(start != 1) //If we're not the beginning of the list, become the previous element. + pref.h_style = valid_hairstyles[start-1] + else //But if we ARE, become the final element. + pref.h_style = valid_hairstyles[valid_hairstyles.len] + return TOPIC_REFRESH_UPDATE_PREVIEW + + else if(href_list["hair_style_right"]) + var/H = href_list["hair_style_right"] + var/list/valid_hairstyles = pref.get_valid_hairstyles() + var/start = valid_hairstyles.Find(H) + + if(start != valid_hairstyles.len) //If we're not the end of the list, become the next element. + pref.h_style = valid_hairstyles[start+1] + else //But if we ARE, become the first element. + pref.h_style = valid_hairstyles[1] + return TOPIC_REFRESH_UPDATE_PREVIEW + else if(href_list["facial_color"]) if(!has_flag(mob_species, HAS_HAIR_COLOR)) return TOPIC_NOACTION @@ -519,23 +514,35 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O return TOPIC_REFRESH_UPDATE_PREVIEW else if(href_list["facial_style"]) - var/list/valid_facialhairstyles = list() - for(var/facialhairstyle in facial_hair_styles_list) - var/datum/sprite_accessory/S = facial_hair_styles_list[facialhairstyle] - if(pref.biological_gender == MALE && S.gender == FEMALE) - continue - if(pref.biological_gender == FEMALE && S.gender == MALE) - continue - if(!(pref.species in S.species_allowed) && (!pref.custom_base || !(pref.custom_base in S.species_allowed))) //VOREStation Edit - Custom species base species allowance - continue - - valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle] + var/list/valid_facialhairstyles = pref.get_valid_facialhairstyles() var/new_f_style = input(user, "Choose your character's facial-hair style:", "Character Preference", pref.f_style) as null|anything in valid_facialhairstyles if(new_f_style && has_flag(mob_species, HAS_HAIR_COLOR) && CanUseTopic(user)) pref.f_style = new_f_style return TOPIC_REFRESH_UPDATE_PREVIEW + else if(href_list["facial_style_left"]) + var/F = href_list["facial_style_left"] + var/list/valid_facialhairstyles = pref.get_valid_facialhairstyles() + var/start = valid_facialhairstyles.Find(F) + + if(start != 1) //If we're not the beginning of the list, become the previous element. + pref.f_style = valid_facialhairstyles[start-1] + else //But if we ARE, become the final element. + pref.f_style = valid_facialhairstyles[valid_facialhairstyles.len] + return TOPIC_REFRESH_UPDATE_PREVIEW + + else if(href_list["facial_style_right"]) + var/F = href_list["facial_style_right"] + var/list/valid_facialhairstyles = pref.get_valid_facialhairstyles() + var/start = valid_facialhairstyles.Find(F) + + if(start != valid_facialhairstyles.len) //If we're not the end of the list, become the next element. + pref.f_style = valid_facialhairstyles[start+1] + else //But if we ARE, become the first element. + pref.f_style = valid_facialhairstyles[1] + return TOPIC_REFRESH_UPDATE_PREVIEW + else if(href_list["marking_style"]) var/list/usable_markings = pref.body_markings.Copy() ^ body_marking_styles_list.Copy() /* VOREStation Removal - No markings whitelist, let people mix/match @@ -569,6 +576,19 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O moveElement(pref.body_markings, start, 1) return TOPIC_REFRESH_UPDATE_PREVIEW + else if(href_list["marking_move"]) + var/M = href_list["marking_move"] + var/start = pref.body_markings.Find(M) + var/list/move_locs = pref.body_markings - M + if(start != 1) + move_locs -= pref.body_markings[start-1] + + var/inject_after = input(user, "Move [M] ahead of...", "Character Preference") as null|anything in move_locs //Move ahead of any marking that isn't the current or previous one. + var/newpos = pref.body_markings.Find(inject_after) + if(newpos) + moveElement(pref.body_markings, start, newpos+1) + return TOPIC_REFRESH_UPDATE_PREVIEW + else if(href_list["marking_remove"]) var/M = href_list["marking_remove"] pref.body_markings -= M diff --git a/code/modules/client/preference_setup/global/01_ui.dm b/code/modules/client/preference_setup/global/01_ui.dm index ed66138da5..a40155d2d5 100644 --- a/code/modules/client/preference_setup/global/01_ui.dm +++ b/code/modules/client/preference_setup/global/01_ui.dm @@ -29,7 +29,7 @@ /datum/category_item/player_setup_item/player_global/ui/content(var/mob/user) . = "UI Style: [pref.UI_style]
" . += "Custom UI (recommended for White UI):
" - . += "-Color: [pref.UI_style_color] 
__
 reset
" + . += "-Color: [pref.UI_style_color] [color_square(hex = pref.UI_style_color)] reset
" . += "-Alpha(transparency): [pref.UI_style_alpha] reset
" . += "Tooltip Style: [pref.tooltipstyle]
" . += "Client FPS: [pref.client_fps]
" @@ -38,7 +38,7 @@ if(pref.ooccolor == initial(pref.ooccolor)) . += "Using Default
" else - . += "[pref.ooccolor]
__
 reset
" + . += "[pref.ooccolor] [color_square(hex = pref.ooccolor)] reset
" /datum/category_item/player_setup_item/player_global/ui/OnTopic(var/href,var/list/href_list, var/mob/user) if(href_list["select_style"]) diff --git a/code/modules/client/preference_setup/preference_setup.dm b/code/modules/client/preference_setup/preference_setup.dm index c99af02ea0..638768ae9e 100644 --- a/code/modules/client/preference_setup/preference_setup.dm +++ b/code/modules/client/preference_setup/preference_setup.dm @@ -298,4 +298,8 @@ return 220 if(PREF_FBP_SOFTWARE) return 150 - return S.max_age // welp \ No newline at end of file + return S.max_age // welp + +/datum/category_item/player_setup_item/proc/color_square(red, green, blue, hex) + var/color = hex ? hex : "#[num2hex(red, 2)][num2hex(green, 2)][num2hex(blue, 2)]" + return "___" \ No newline at end of file diff --git a/code/modules/client/preference_setup/vore/01_ears.dm b/code/modules/client/preference_setup/vore/01_ears.dm index dbd4653fbc..8a26513a01 100644 --- a/code/modules/client/preference_setup/vore/01_ears.dm +++ b/code/modules/client/preference_setup/vore/01_ears.dm @@ -154,9 +154,9 @@ if(ear_styles_list[pref.ear_style]) var/datum/sprite_accessory/ears/ear = ear_styles_list[pref.ear_style] if (ear.do_colouration) - . += "Change Color
__

" + . += "Change Color [color_square(pref.r_ears, pref.g_ears, pref.b_ears)]
" if (ear.extra_overlay) - . += "Change Secondary Color
__

" + . += "Change Secondary Color [color_square(pref.r_ears2, pref.g_ears2, pref.b_ears2)]
" var/tail_display = "Normal" if(pref.tail_style && (pref.tail_style in tail_styles_list)) @@ -170,9 +170,9 @@ if(tail_styles_list[pref.tail_style]) var/datum/sprite_accessory/tail/T = tail_styles_list[pref.tail_style] if (T.do_colouration) - . += "Change Color
__

" + . += "Change Color [color_square(pref.r_tail, pref.g_tail, pref.b_tail)]
" if (T.extra_overlay) - . += "Change Secondary Color
__

" + . += "Change Secondary Color [color_square(pref.r_tail2, pref.g_tail2, pref.b_tail2)]
" var/wing_display = "Normal" if(pref.wing_style && (pref.wing_style in wing_styles_list)) @@ -186,9 +186,9 @@ if(wing_styles_list[pref.wing_style]) var/datum/sprite_accessory/wing/W = wing_styles_list[pref.wing_style] if (W.do_colouration) - . += "Change Color
__

" + . += "Change Color [color_square(pref.r_wing, pref.g_wing, pref.b_wing)]
" if (W.extra_overlay) - . += "Change Secondary Color
__

" + . += "Change Secondary Color [color_square(pref.r_wing2, pref.g_wing2, pref.b_wing2)]
" /datum/category_item/player_setup_item/vore/ears/OnTopic(var/href,var/list/href_list, var/mob/user) if(!CanUseTopic(user)) diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 6464642a3b..ff68a02eac 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -277,3 +277,31 @@ break return highJob + +/datum/preferences/proc/get_valid_hairstyles() + var/list/valid_hairstyles = list() + for(var/hairstyle in hair_styles_list) + var/datum/sprite_accessory/S = hair_styles_list[hairstyle] + if(!(species in S.species_allowed) && (!custom_base || !(custom_base in S.species_allowed))) //VOREStation Edit - Custom species base species allowance + continue + if((!S.ckeys_allowed) || (usr.ckey in S.ckeys_allowed)) //VOREStation Edit, allows ckey locked hairstyles. + valid_hairstyles[S.name] = hairstyle //VOREStation Edit, allows ckey locked hairstyles. + + //valid_hairstyles[hairstyle] = hair_styles_list[hairstyle] //VOREStation Edit. Replaced by above. + + return valid_hairstyles + +/datum/preferences/proc/get_valid_facialhairstyles() + var/list/valid_facialhairstyles = list() + for(var/facialhairstyle in facial_hair_styles_list) + var/datum/sprite_accessory/S = facial_hair_styles_list[facialhairstyle] + if(biological_gender == MALE && S.gender == FEMALE) + continue + if(biological_gender == FEMALE && S.gender == MALE) + continue + if(!(species in S.species_allowed) && (!custom_base || !(custom_base in S.species_allowed))) //VOREStation Edit - Custom species base species allowance + continue + + valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle] + + return valid_facialhairstyles diff --git a/html/changelogs/KasparoVv - PR - 7215.yml b/html/changelogs/KasparoVv - PR - 7215.yml new file mode 100644 index 0000000000..efd745d1a9 --- /dev/null +++ b/html/changelogs/KasparoVv - PR - 7215.yml @@ -0,0 +1,7 @@ +author: KasparoVv +delete-after: True +changes: + - rscadd: "You can now quickly cycle hrough previous or next hair/facial styles at character creation." + - rscadd: "Use the -mv- button to pick a marking and place it above of another on your character. Saves you from pressing up or down a bunch." + - tweak: "Ports color_square() from Paradise for colour previews, cleaning up pref. code & correct alignment issue w/ nested tables." + - tweak: "Markings are now properly aligned within a table." \ No newline at end of file