Fair Hades (sic!) (#10718)

adds hair fades ported from polaris

https://github.com/PolarisSS13/Polaris/pull/7313/files
This commit is contained in:
Wowzewow (Wezzy)
2020-12-28 21:06:28 +08:00
committed by GitHub
parent 16c9469fe9
commit 5afbb615f9
10 changed files with 178 additions and 7 deletions
@@ -14,12 +14,16 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
S["facial_red"] >> pref.r_facial
S["facial_green"] >> pref.g_facial
S["facial_blue"] >> pref.b_facial
S["grad_red"] >> pref.r_grad
S["grad_green"] >> pref.g_grad
S["grad_blue"] >> pref.b_grad
S["skin_tone"] >> pref.s_tone
S["skin_red"] >> pref.r_skin
S["skin_green"] >> pref.g_skin
S["skin_blue"] >> pref.b_skin
S["hair_style_name"] >> pref.h_style
S["facial_style_name"] >> pref.f_style
S["grad_style_name"] >> pref.g_style
S["eyes_red"] >> pref.r_eyes
S["eyes_green"] >> pref.g_eyes
S["eyes_blue"] >> pref.b_eyes
@@ -36,12 +40,16 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
S["facial_red"] << pref.r_facial
S["facial_green"] << pref.g_facial
S["facial_blue"] << pref.b_facial
S["grad_red"] << pref.r_grad
S["grad_green"] << pref.g_grad
S["grad_blue"] << pref.b_grad
S["skin_tone"] << pref.s_tone
S["skin_red"] << pref.r_skin
S["skin_green"] << pref.g_skin
S["skin_blue"] << pref.b_skin
S["hair_style_name"] << pref.h_style
S["facial_style_name"] << pref.f_style
S["grad_style_name"] << pref.g_style
S["eyes_red"] << pref.r_eyes
S["eyes_green"] << pref.g_eyes
S["eyes_blue"] << pref.b_eyes
@@ -50,7 +58,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
S["organ_data"] << pref.organ_data
S["rlimb_data"] << pref.rlimb_data
S["body_markings"] << pref.body_markings
S["bgstate"] << pref.bgstate
S["bgstate"] << pref.bgstate
/datum/category_item/player_setup_item/general/body/gather_load_query()
return list(
@@ -58,10 +66,12 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
"vars" = list(
"hair_colour",
"facial_colour",
"grad_colour",
"skin_tone" = "s_tone",
"skin_colour",
"hair_style" = "h_style",
"facial_style" = "f_style",
"gradient_style" = "g_style",
"eyes_colour",
"b_type",
"disabilities",
@@ -82,10 +92,12 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
"ss13_characters" = list(
"hair_colour",
"facial_colour",
"grad_colour",
"skin_tone",
"skin_colour",
"hair_style",
"facial_style",
"gradient_style",
"eyes_colour",
"b_type",
"disabilities",
@@ -102,10 +114,12 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
return list(
"hair_colour" = rgb(pref.r_hair, pref.g_hair, pref.b_hair),
"facial_colour" = rgb(pref.r_facial, pref.g_facial, pref.b_facial),
"grad_colour" = rgb(pref.r_grad, pref.g_grad, pref.g_grad),
"skin_tone" = pref.s_tone,
"skin_colour" = rgb(pref.r_skin, pref.g_skin, pref.b_skin) ,
"hair_style" = pref.h_style,
"facial_style" = pref.f_style,
"gradient_style"= pref.g_style,
"eyes_colour" = rgb(pref.r_eyes, pref.g_eyes, pref.b_eyes),
"b_type" = pref.b_type,
"disabilities" = json_encode(pref.disabilities),
@@ -129,6 +143,11 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.g_facial = GetGreenPart(pref.facial_colour)
pref.b_facial = GetBluePart(pref.facial_colour)
pref.grad_colour = sanitize_hexcolor(pref.grad_colour)
pref.r_grad = GetRedPart(pref.grad_colour)
pref.g_grad = GetGreenPart(pref.grad_colour)
pref.b_grad = GetBluePart(pref.grad_colour)
pref.s_tone = text2num(pref.s_tone)
pref.skin_colour = sanitize_hexcolor(pref.skin_colour)
@@ -172,6 +191,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.b_skin = sanitize_integer(pref.b_skin, 0, 255, initial(pref.b_skin))
pref.h_style = sanitize_inlist(pref.h_style, hair_styles_list, initial(pref.h_style))
pref.f_style = sanitize_inlist(pref.f_style, facial_hair_styles_list, initial(pref.f_style))
pref.g_style = sanitize_inlist(pref.g_style, hair_gradient_styles_list, initial(pref.g_style))
pref.r_eyes = sanitize_integer(pref.r_eyes, 0, 255, initial(pref.r_eyes))
pref.g_eyes = sanitize_integer(pref.g_eyes, 0, 255, initial(pref.g_eyes))
pref.b_eyes = sanitize_integer(pref.b_eyes, 0, 255, initial(pref.b_eyes))
@@ -273,6 +293,11 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
out += "<a href='?src=\ref[src];facial_color=1'>Change Color</a> [HTML_RECT(rgb(pref.r_facial, pref.g_facial, pref.b_facial))] "
out += " Style: <a href='?src=\ref[src];facial_style=1'>[pref.f_style]</a><br>"
out += "<b>Gradient</b><br>"
if(has_flag(mob_species, HAS_HAIR_COLOR))
out += "<a href='?src=\ref[src];gradient_color=1'>Change Color</a> [HTML_RECT(rgb(pref.r_grad, pref.g_grad, pref.b_grad))] "
out += " Style: <a href='?src=\ref[src];gradient_style=1'>[pref.g_style]</a><br>"
if(has_flag(mob_species, HAS_EYE_COLOR))
out += "<br><b>Eyes</b><br>"
out += "<a href='?src=\ref[src];eye_color=1'>Change Color</a> [HTML_RECT(rgb(pref.r_eyes, pref.g_eyes, pref.b_eyes))] <br>"
@@ -402,6 +427,16 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.b_hair = GetBluePart(new_hair)
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["gradient_color"])
if(!has_flag(mob_species, HAS_HAIR_COLOR))
return TOPIC_NOACTION
var/new_grad = input(user, "Choose your character's secondary hair color:", "Character Preference", rgb(pref.r_grad, pref.g_grad, pref.b_grad)) as color|null
if(new_grad && has_flag(mob_species, HAS_HAIR_COLOR) && CanUseTopic(user))
pref.r_grad = GetRedPart(new_grad)
pref.g_grad = GetGreenPart(new_grad)
pref.b_grad = GetBluePart(new_grad)
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["hair_style"])
if(mob_species.bald)
return
@@ -419,6 +454,20 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O
pref.h_style = new_h_style
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["gradient_style"])
var/list/valid_gradients = list()
for(var/gradstyle in hair_gradient_styles_list)
var/datum/sprite_accessory/S = hair_gradient_styles_list[gradstyle]
if(!(mob_species.type in S.species_allowed))
continue
valid_gradients[gradstyle] = hair_gradient_styles_list[gradstyle]
var/new_g_style = input(user, "Choose a color pattern for your hair:", "Character Preference", pref.g_style) as null|anything in valid_gradients
if(new_g_style && CanUseTopic(user))
pref.g_style = new_g_style
return TOPIC_REFRESH_UPDATE_PREVIEW
else if(href_list["facial_color"])
if(!has_flag(mob_species, HAS_HAIR_COLOR))
return TOPIC_NOACTION
+10 -3
View File
@@ -49,6 +49,11 @@ datum/preferences
var/r_hair = 0 //Hair color
var/g_hair = 0 //Hair color
var/b_hair = 0 //Hair color
var/g_style = "None" //Gradient style
var/grad_colour = "#000000" //Gradient colour hex value, for SQL loading
var/r_grad = 0 //Gradient color
var/g_grad = 0 //Gradient color
var/b_grad = 0 //Gradient color
var/f_style = "Shaved" //Face hair type
var/facial_colour = "#000000" //Facial colour hex value, for SQL loading
var/r_facial = 0 //Face hair color
@@ -436,15 +441,17 @@ datum/preferences
character.g_facial = g_facial
character.b_facial = b_facial
character.g_style = g_style
character.r_grad = r_grad
character.g_grad = g_grad
character.b_grad = b_grad
character.r_skin = r_skin
character.g_skin = g_skin
character.b_skin = b_skin
character.s_tone = s_tone
character.h_style = h_style
character.f_style = f_style
character.citizenship = citizenship
character.employer_faction = faction
character.religion = religion
@@ -1712,7 +1712,48 @@ Follow by example and make good judgement based on length which list to include
length = 2
chatname = "ponytail"
/*
/////////////////////////////////////
/ =-----------------------------= /
/ == Hair Gradient Definitions == /
/ =-----------------------------= /
/////////////////////////////////////
*/
/datum/sprite_accessory/hair_gradients
icon = 'icons/mob/hair_gradients.dmi'
none
name = "None"
icon_state = "none"
fade_up
name = "Fade (Up)"
icon_state = "fadeup"
fade_down
name = "Fade (Down)"
icon_state = "fadedown"
fade_right
name = "Fade (Right)"
icon_state = "faderight"
fade_left
name = "Fade (Left)"
icon_state = "fadeleft"
vertical_split_right
name = "Vertical Split (Right)"
icon_state = "vsplit_right"
vertical_split_left
name = "Vertical Split (Left)"
icon_state = "vsplit_left"
horizontal
name = "Horizontal Split"
icon_state = "hsplit"
/*
///////////////////////////////////
/ =---------------------------= /
@@ -3155,4 +3196,4 @@ Follow by example and make good judgement based on length which list to include
xion_lights
name = "Xion - Lights Color"
icon_state = "xion_lights"
body_parts = list(BP_L_LEG,BP_R_LEG,BP_L_ARM,BP_R_ARM,BP_CHEST,BP_HEAD)
body_parts = list(BP_L_LEG,BP_R_LEG,BP_L_ARM,BP_R_ARM,BP_CHEST,BP_HEAD)
@@ -5,6 +5,12 @@
var/b_hair = 0
var/h_style = "Bald"
//Hair gradient color and style
var/r_grad = 0
var/g_grad = 0
var/b_grad = 0
var/g_style = "None"
//Facial hair colour and style
var/r_facial = 0
var/g_facial = 0
@@ -116,4 +122,4 @@
var/datum/unarmed_attack/default_attack //default unarmed attack
var/datum/martial_art/primary_martial_art = null
var/list/datum/martial_art/known_martial_arts = null
var/list/datum/martial_art/known_martial_arts = null
@@ -236,6 +236,7 @@
var/default_h_style = "Bald"
var/default_f_style = "Shaved"
var/default_g_style = "None"
var/list/allowed_citizenships = list(CITIZENSHIP_BIESEL, CITIZENSHIP_SOL, CITIZENSHIP_COALITION, CITIZENSHIP_ELYRA, CITIZENSHIP_ERIDANI, CITIZENSHIP_DOMINIA)
var/list/allowed_religions = list(RELIGION_NONE, RELIGION_OTHER, RELIGION_CHRISTIANITY, RELIGION_ISLAM, RELIGION_JUDAISM, RELIGION_HINDU, RELIGION_BUDDHISM, RELIGION_MOROZ, RELIGION_TRINARY, RELIGION_SCARAB, RELIGION_TAOISM)
@@ -607,6 +608,7 @@
/datum/species/proc/set_default_hair(var/mob/living/carbon/human/H)
H.h_style = H.species.default_h_style
H.f_style = H.species.default_f_style
H.g_style = H.species.default_g_style
H.update_hair()
/datum/species/proc/get_species_tally(var/mob/living/carbon/human/H)
@@ -370,7 +370,7 @@ There are several things that need to be remembered:
// This proc generates & returns an icon representing a human's hair, using a cached icon from SSicon_cache if possible.
// If `hair_is_visible` is FALSE, only facial hair will be drawn.
/mob/living/carbon/human/proc/generate_hair_icon(hair_is_visible = TRUE)
var/cache_key = "[f_style ? "[f_style][r_facial][g_facial][b_facial]" : "nofacial"]_[(h_style && hair_is_visible) ? "[h_style][r_hair][g_hair][b_hair]" : "nohair"]"
var/cache_key = "[f_style ? "[f_style][r_facial][g_facial][b_facial]" : "nofacial"]_[(h_style && hair_is_visible) ? "[h_style][r_hair][g_hair][b_hair]" : "nohair"]_[(g_style && g_style != "None" && hair_is_visible) ? "[g_style][r_grad][g_grad][b_grad]" : "nograd"]"
var/icon/face_standing = SSicon_cache.human_hair_cache[cache_key]
if (!face_standing) // Not cached, generate it from scratch.
@@ -387,11 +387,19 @@ There are several things that need to be remembered:
// Hair.
if(hair_is_visible)
var/icon/grad_s = null
var/datum/sprite_accessory/hair_style = hair_styles_list[h_style]
if(hair_style && (species.type in hair_style.species_allowed))
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = hair_style.icon_state)
if(hair_style.do_colouration)
if(g_style)
var/datum/sprite_accessory/gradient_style = hair_gradient_styles_list[g_style]
grad_s = new/icon("icon" = gradient_style.icon, "icon_state" = gradient_style.icon_state)
grad_s.Blend(hair_s, ICON_AND)
grad_s.Blend(rgb(r_grad, g_grad, b_grad), ICON_MULTIPLY)
hair_s.Blend(rgb(r_hair, g_hair, b_hair), hair_style.icon_blend_mode)
if(!isnull(grad_s))
hair_s.Blend(grad_s, ICON_OVERLAY)
face_standing.Blend(hair_s, ICON_OVERLAY)