From 213b6bba254e75f33ced8693d10491ec1a9d000f Mon Sep 17 00:00:00 2001
From: KasparoVy <12377767+KasparoVy@users.noreply.github.com>
Date: Thu, 21 May 2020 03:49:41 -0400
Subject: [PATCH 1/5] Streamline (Facial) Hair & Marking Character
Customization
Adds the ability to shift to the previous or next facial hair style. The buttons are behind the style because this way you don't have to move your mouse when the style changes.
If you click forward while on the last style, it'll shift to the first one.
If you click backward while on the first style, it'll shift to the last one.
For markings, you can now pick a marking and inject it infront of another so long as it isn't the one you picked, or the one directly behind in the list order.
---
.../preference_setup/general/03_body.dm | 106 +++++++++++-------
.../mob/new_player/preferences_setup.dm | 26 +++++
2 files changed, 90 insertions(+), 42 deletions(-)
diff --git a/code/modules/client/preference_setup/general/03_body.dm b/code/modules/client/preference_setup/general/03_body.dm
index 92beaa5d9a..b042206d0d 100644
--- a/code/modules/client/preference_setup/general/03_body.dm
+++ b/code/modules/client/preference_setup/general/03_body.dm
@@ -322,12 +322,12 @@ 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]
"
+ . += " Style: < > [pref.h_style]
"
. += "
Facial
"
if(has_flag(mob_species, HAS_HAIR_COLOR))
. += "Change Color "
- . += " Style: [pref.f_style]
"
+ . += " Style: < > [pref.f_style]
"
if(has_flag(mob_species, HAS_EYE_COLOR))
. += "
Eyes
"
@@ -339,7 +339,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
. += "
Body Markings +
"
for(var/M in pref.body_markings)
- . += "[M] [pref.body_markings.len > 1 ? "˄ ˅ " : ""]- Color"
+ . += "[M] [pref.body_markings.len > 1 ? "˄ ˅ mv " : ""]- Color"
. += ""
. += "
"
@@ -408,16 +408,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.set_biological_gender(mob_species.genders[1])
//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)
@@ -426,17 +417,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)
@@ -470,19 +451,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))
- continue
-
- valid_hairstyles[hairstyle] = hair_styles_list[hairstyle]
+ 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
@@ -522,23 +519,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))
- 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()
for(var/M in usable_markings)
@@ -571,6 +580,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/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm
index 886dae69e3..e9a2355d2a 100644
--- a/code/modules/mob/new_player/preferences_setup.dm
+++ b/code/modules/mob/new_player/preferences_setup.dm
@@ -289,3 +289,29 @@
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))
+ continue
+
+ valid_hairstyles[hairstyle] = hair_styles_list[hairstyle]
+
+ 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))
+ continue
+
+ valid_facialhairstyles[facialhairstyle] = facial_hair_styles_list[facialhairstyle]
+
+ return valid_facialhairstyles
From 1561cd7de680d6f2983c7ac9b161a965a1fb55c5 Mon Sep 17 00:00:00 2001
From: KasparoVy <12377767+KasparoVy@users.noreply.github.com>
Date: Thu, 21 May 2020 03:57:43 -0400
Subject: [PATCH 2/5] Changelog
CHANGE THE LOGS GODDAMN SON
---
html/changelogs/KasparoVv - PR - 7215.yml | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 html/changelogs/KasparoVv - PR - 7215.yml
diff --git a/html/changelogs/KasparoVv - PR - 7215.yml b/html/changelogs/KasparoVv - PR - 7215.yml
new file mode 100644
index 0000000000..96dc26e107
--- /dev/null
+++ b/html/changelogs/KasparoVv - PR - 7215.yml
@@ -0,0 +1,5 @@
+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."
\ No newline at end of file
From b4ef771626bea188cace36d8efdda85d2b04033a Mon Sep 17 00:00:00 2001
From: KasparoVy <12377767+KasparoVy@users.noreply.github.com>
Date: Sat, 30 May 2020 01:41:42 -0400
Subject: [PATCH 3/5] Ports color_square from Paradise to Clean up Prefcode &
Fix Alignment
Fixes an alignment issue with inline tables nested inside table rows & cleans up code.
---
.../client/preference_setup/general/03_body.dm | 16 ++++++++--------
.../client/preference_setup/global/01_ui.dm | 4 ++--
.../client/preference_setup/preference_setup.dm | 6 +++++-
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/code/modules/client/preference_setup/general/03_body.dm b/code/modules/client/preference_setup/general/03_body.dm
index b042206d0d..614e3c794f 100644
--- a/code/modules/client/preference_setup/general/03_body.dm
+++ b/code/modules/client/preference_setup/general/03_body.dm
@@ -321,33 +321,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 "
+ . += "Change Color [color_square(pref.r_hair, pref.g_hair, pref.b_hair)] "
. += " Style: < > [pref.h_style]
"
. += "
Facial
"
if(has_flag(mob_species, HAS_HAIR_COLOR))
- . += "Change Color "
+ . += "Change Color [color_square(pref.r_facial, pref.g_facial, pref.b_facial)] "
. += " Style: < > [pref.f_style]
"
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 ? "˄ ˅ mv " : ""]- 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)
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 f53bf82cb8..4d6b15d685 100644
--- a/code/modules/client/preference_setup/preference_setup.dm
+++ b/code/modules/client/preference_setup/preference_setup.dm
@@ -304,4 +304,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
From 52960d2e5d7df0846f47bdbc664a824c36b2c52d Mon Sep 17 00:00:00 2001
From: KasparoVy <12377767+KasparoVy@users.noreply.github.com>
Date: Sat, 30 May 2020 01:47:12 -0400
Subject: [PATCH 4/5] Update CL
---
html/changelogs/KasparoVv - PR - 7215.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/html/changelogs/KasparoVv - PR - 7215.yml b/html/changelogs/KasparoVv - PR - 7215.yml
index 96dc26e107..efd745d1a9 100644
--- a/html/changelogs/KasparoVv - PR - 7215.yml
+++ b/html/changelogs/KasparoVv - PR - 7215.yml
@@ -2,4 +2,6 @@ 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."
\ No newline at end of file
+ - 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
From 37193518561b695ac47fda4ae7912416ed29d899 Mon Sep 17 00:00:00 2001
From: KasparoVy <12377767+KasparoVy@users.noreply.github.com>
Date: Sat, 30 May 2020 01:49:59 -0400
Subject: [PATCH 5/5] Let em know
Thanks Atermonera
---
code/modules/client/preference_setup/general/03_body.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/modules/client/preference_setup/general/03_body.dm b/code/modules/client/preference_setup/general/03_body.dm
index 614e3c794f..d5edede6ce 100644
--- a/code/modules/client/preference_setup/general/03_body.dm
+++ b/code/modules/client/preference_setup/general/03_body.dm
@@ -322,12 +322,12 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
. += "Hair
"
if(has_flag(mob_species, HAS_HAIR_COLOR))
. += "Change Color [color_square(pref.r_hair, pref.g_hair, pref.b_hair)] "
- . += " Style: < > [pref.h_style]
"
+ . += " 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 [color_square(pref.r_facial, pref.g_facial, pref.b_facial)] "
- . += " Style: < > [pref.f_style]
"
+ . += " Style: < > [pref.f_style]
" //Same as above with the extra > & < characters
if(has_flag(mob_species, HAS_EYE_COLOR))
. += "
Eyes
"