mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-07-19 12:12:43 +01:00
Merge pull request #7215 from KasparoVy/faster-faster-yet-faster
Streamline (Facial) Hair & Marking Character Customization, Port color_square to Clean Prefcode
This commit is contained in:
@@ -321,33 +321,33 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
|
||||
|
||||
. += "<b>Hair</b><br>"
|
||||
if(has_flag(mob_species, HAS_HAIR_COLOR))
|
||||
. += "<a href='?src=\ref[src];hair_color=1'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(pref.r_hair, 2)][num2hex(pref.g_hair, 2)][num2hex(pref.b_hair, 2)]'><table style='display:inline;' bgcolor='#[num2hex(pref.r_hair, 2)][num2hex(pref.g_hair, 2)][num2hex(pref.b_hair, 2)]'><tr><td>__</td></tr></table></font> "
|
||||
. += " Style: <a href='?src=\ref[src];hair_style=1'>[pref.h_style]</a><br>"
|
||||
. += "<a href='?src=\ref[src];hair_color=1'>Change Color</a> [color_square(pref.r_hair, pref.g_hair, pref.b_hair)] "
|
||||
. += " Style: <a href='?src=\ref[src];hair_style_left=[pref.h_style]'><</a> <a href='?src=\ref[src];hair_style_right=[pref.h_style]''>></a> <a href='?src=\ref[src];hair_style=1'>[pref.h_style]</a><br>" //The <</a> & ></a> in this line is correct-- those extra characters are the arrows you click to switch between styles.
|
||||
|
||||
. += "<br><b>Facial</b><br>"
|
||||
if(has_flag(mob_species, HAS_HAIR_COLOR))
|
||||
. += "<a href='?src=\ref[src];facial_color=1'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(pref.r_facial, 2)][num2hex(pref.g_facial, 2)][num2hex(pref.b_facial, 2)]'><table style='display:inline;' bgcolor='#[num2hex(pref.r_facial, 2)][num2hex(pref.g_facial, 2)][num2hex(pref.b_facial, 2)]'><tr><td>__</td></tr></table></font> "
|
||||
. += " Style: <a href='?src=\ref[src];facial_style=1'>[pref.f_style]</a><br>"
|
||||
. += "<a href='?src=\ref[src];facial_color=1'>Change Color</a> [color_square(pref.r_facial, pref.g_facial, pref.b_facial)] "
|
||||
. += " Style: <a href='?src=\ref[src];facial_style_left=[pref.f_style]'><</a> <a href='?src=\ref[src];facial_style_right=[pref.f_style]''>></a> <a href='?src=\ref[src];facial_style=1'>[pref.f_style]</a><br>" //Same as above with the extra > & < characters
|
||||
|
||||
if(has_flag(mob_species, HAS_EYE_COLOR))
|
||||
. += "<br><b>Eyes</b><br>"
|
||||
. += "<a href='?src=\ref[src];eye_color=1'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(pref.r_eyes, 2)][num2hex(pref.g_eyes, 2)][num2hex(pref.b_eyes, 2)]'><table style='display:inline;' bgcolor='#[num2hex(pref.r_eyes, 2)][num2hex(pref.g_eyes, 2)][num2hex(pref.b_eyes, 2)]'><tr><td>__</td></tr></table></font><br>"
|
||||
. += "<a href='?src=\ref[src];eye_color=1'>Change Color</a> [color_square(pref.r_eyes, pref.g_eyes, pref.b_eyes)]<br>"
|
||||
|
||||
if(has_flag(mob_species, HAS_SKIN_COLOR))
|
||||
. += "<br><b>Body Color</b><br>"
|
||||
. += "<a href='?src=\ref[src];skin_color=1'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(pref.r_skin, 2)][num2hex(pref.g_skin, 2)][num2hex(pref.b_skin, 2)]'><table style='display:inline;' bgcolor='#[num2hex(pref.r_skin, 2)][num2hex(pref.g_skin, 2)][num2hex(pref.b_skin, 2)]'><tr><td>__</td></tr></table></font><br>"
|
||||
. += "<a href='?src=\ref[src];skin_color=1'>Change Color</a> [color_square(pref.r_skin, pref.g_skin, pref.b_skin)]<br>"
|
||||
|
||||
. += "<br><a href='?src=\ref[src];marking_style=1'>Body Markings +</a><br>"
|
||||
. += "<table>"
|
||||
for(var/M in pref.body_markings)
|
||||
. += "[M] [pref.body_markings.len > 1 ? "<a href='?src=\ref[src];marking_up=[M]'>˄</a> <a href='?src=\ref[src];marking_down=[M]'>˅</a> " : ""]<a href='?src=\ref[src];marking_remove=[M]'>-</a> <a href='?src=\ref[src];marking_color=[M]'>Color</a>"
|
||||
. += "<font face='fixedsys' size='3' color='[pref.body_markings[M]]'><table style='display:inline;' bgcolor='[pref.body_markings[M]]'><tr><td>__</td></tr></table></font>"
|
||||
. += "<br>"
|
||||
. += "<tr><td>[M]</td><td>[pref.body_markings.len > 1 ? "<a href='?src=\ref[src];marking_up=[M]'>˄</a> <a href='?src=\ref[src];marking_down=[M]'>˅</a> <a href='?src=\ref[src];marking_move=[M]'>mv</a> " : ""]<a href='?src=\ref[src];marking_remove=[M]'>-</a> <a href='?src=\ref[src];marking_color=[M]'>Color</a>[color_square(hex = pref.body_markings[M])]</td></tr>"
|
||||
|
||||
. += "</table>"
|
||||
. += "<br>"
|
||||
. += "<b>Allow Synth markings:</b> <a href='?src=\ref[src];synth_markings=1'><b>[pref.synth_markings ? "Yes" : "No"]</b></a><br>"
|
||||
. += "<b>Allow Synth color:</b> <a href='?src=\ref[src];synth_color=1'><b>[pref.synth_color ? "Yes" : "No"]</b></a><br>"
|
||||
if(pref.synth_color)
|
||||
. += "<a href='?src=\ref[src];synth2_color=1'>Change Color</a> <font face='fixedsys' size='3' color='#[num2hex(pref.r_synth, 2)][num2hex(pref.g_synth, 2)][num2hex(pref.b_synth, 2)]'><table style='display:inline;' bgcolor='#[num2hex(pref.r_synth, 2)][num2hex(pref.g_synth, 2)][num2hex(pref.b_synth, 2)]'><tr><td>__</td></tr></table></font> "
|
||||
. += "<a href='?src=\ref[src];synth2_color=1'>Change Color</a> [color_square(pref.r_synth, pref.g_synth, pref.b_synth)]"
|
||||
|
||||
. = jointext(.,null)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
/datum/category_item/player_setup_item/player_global/ui/content(var/mob/user)
|
||||
. = "<b>UI Style:</b> <a href='?src=\ref[src];select_style=1'><b>[pref.UI_style]</b></a><br>"
|
||||
. += "<b>Custom UI</b> (recommended for White UI):<br>"
|
||||
. += "-Color: <a href='?src=\ref[src];select_color=1'><b>[pref.UI_style_color]</b></a> <table style='display:inline;' bgcolor='[pref.UI_style_color]'><tr><td>__</td></tr></table> <a href='?src=\ref[src];reset=ui'>reset</a><br>"
|
||||
. += "-Color: <a href='?src=\ref[src];select_color=1'><b>[pref.UI_style_color]</b></a> [color_square(hex = pref.UI_style_color)] <a href='?src=\ref[src];reset=ui'>reset</a><br>"
|
||||
. += "-Alpha(transparency): <a href='?src=\ref[src];select_alpha=1'><b>[pref.UI_style_alpha]</b></a> <a href='?src=\ref[src];reset=alpha'>reset</a><br>"
|
||||
. += "<b>Tooltip Style:</b> <a href='?src=\ref[src];select_tooltip_style=1'><b>[pref.tooltipstyle]</b></a><br>"
|
||||
. += "<b>Client FPS:</b> <a href='?src=\ref[src];select_client_fps=1'><b>[pref.client_fps]</b></a><br>"
|
||||
@@ -38,7 +38,7 @@
|
||||
if(pref.ooccolor == initial(pref.ooccolor))
|
||||
. += "<a href='?src=\ref[src];select_ooc_color=1'><b>Using Default</b></a><br>"
|
||||
else
|
||||
. += "<a href='?src=\ref[src];select_ooc_color=1'><b>[pref.ooccolor]</b></a> <table style='display:inline;' bgcolor='[pref.ooccolor]'><tr><td>__</td></tr></table> <a href='?src=\ref[src];reset=ooc'>reset</a><br>"
|
||||
. += "<a href='?src=\ref[src];select_ooc_color=1'><b>[pref.ooccolor]</b></a> [color_square(hex = pref.ooccolor)] <a href='?src=\ref[src];reset=ooc'>reset</a><br>"
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/ui/OnTopic(var/href,var/list/href_list, var/mob/user)
|
||||
if(href_list["select_style"])
|
||||
|
||||
@@ -304,4 +304,8 @@
|
||||
return 220
|
||||
if(PREF_FBP_SOFTWARE)
|
||||
return 150
|
||||
return S.max_age // welp
|
||||
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 "<span style='font-face: fixedsys; font-size: 14px; background-color: [color]; color: [color]'>___</span>"
|
||||
Reference in New Issue
Block a user