diff --git a/code/modules/client/preference_setup/general/03_body.dm b/code/modules/client/preference_setup/general/03_body.dm index 40171f8c92..85fac16b29 100644 --- a/code/modules/client/preference_setup/general/03_body.dm +++ b/code/modules/client/preference_setup/general/03_body.dm @@ -15,6 +15,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O S["hair_red"] >> pref.r_hair S["hair_green"] >> pref.g_hair S["hair_blue"] >> pref.b_hair + S["grad_red"] >> pref.r_grad + S["grad_green"] >> pref.g_grad + S["grad_blue"] >> pref.b_grad S["facial_red"] >> pref.r_facial S["facial_green"] >> pref.g_facial S["facial_blue"] >> pref.b_facial @@ -23,6 +26,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O S["skin_green"] >> pref.g_skin S["skin_blue"] >> pref.b_skin S["hair_style_name"] >> pref.h_style + S["grad_style_name"] >> pref.grad_style S["facial_style_name"] >> pref.f_style S["eyes_red"] >> pref.r_eyes S["eyes_green"] >> pref.g_eyes @@ -50,6 +54,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O S["hair_red"] << pref.r_hair S["hair_green"] << pref.g_hair S["hair_blue"] << pref.b_hair + S["grad_red"] << pref.r_grad + S["grad_green"] << pref.g_grad + S["grad_blue"] << pref.b_grad S["facial_red"] << pref.r_facial S["facial_green"] << pref.g_facial S["facial_blue"] << pref.b_facial @@ -58,6 +65,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O S["skin_green"] << pref.g_skin S["skin_blue"] << pref.b_skin S["hair_style_name"] << pref.h_style + S["grad_style_name"] << pref.grad_style S["facial_style_name"] << pref.f_style S["eyes_red"] << pref.r_eyes S["eyes_green"] << pref.g_eyes @@ -86,6 +94,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O pref.r_hair = sanitize_integer(pref.r_hair, 0, 255, initial(pref.r_hair)) pref.g_hair = sanitize_integer(pref.g_hair, 0, 255, initial(pref.g_hair)) pref.b_hair = sanitize_integer(pref.b_hair, 0, 255, initial(pref.b_hair)) + pref.r_grad = sanitize_integer(pref.r_grad, 0, 255, initial(pref.r_grad)) + pref.g_grad = sanitize_integer(pref.g_grad, 0, 255, initial(pref.g_grad)) + pref.b_grad = sanitize_integer(pref.b_grad, 0, 255, initial(pref.b_grad)) pref.r_facial = sanitize_integer(pref.r_facial, 0, 255, initial(pref.r_facial)) pref.g_facial = sanitize_integer(pref.g_facial, 0, 255, initial(pref.g_facial)) pref.b_facial = sanitize_integer(pref.b_facial, 0, 255, initial(pref.b_facial)) @@ -94,6 +105,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O pref.g_skin = sanitize_integer(pref.g_skin, 0, 255, initial(pref.g_skin)) 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.grad_style = sanitize_inlist(pref.grad_style, GLOB.hair_gradients, initial(pref.grad_style)) pref.f_style = sanitize_inlist(pref.f_style, facial_hair_styles_list, initial(pref.f_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)) @@ -118,6 +130,9 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O character.r_hair = pref.r_hair character.g_hair = pref.g_hair character.b_hair = pref.b_hair + character.r_grad = pref.r_grad + character.g_grad = pref.g_grad + character.b_grad = pref.b_grad character.f_style = pref.f_style character.r_facial = pref.r_facial character.g_facial = pref.g_facial @@ -127,6 +142,7 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O character.b_skin = pref.b_skin character.s_tone = pref.s_tone character.h_style = pref.h_style + character.grad_style= pref.grad_style character.f_style = pref.f_style character.b_type = pref.b_type character.synth_color = pref.synth_color @@ -343,7 +359,11 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O 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]
" //The < & > in this line is correct-- those extra characters are the arrows you click to switch between styles. - + + . += "Gradient
" + . += "Change Color [color_square(pref.r_grad, pref.g_grad, pref.b_grad)] " + . += " Style: < > [pref.grad_style]
" + . += "
Facial
" if(has_flag(mob_species, HAS_HAIR_COLOR)) . += "Change Color [color_square(pref.r_facial, pref.g_facial, pref.b_facial)] " @@ -472,6 +492,16 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O pref.g_hair = hex2num(copytext(new_hair, 4, 6)) pref.b_hair = hex2num(copytext(new_hair, 6, 8)) return TOPIC_REFRESH_UPDATE_PREVIEW + + else if(href_list["grad_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 = hex2num(copytext(new_grad, 2, 4)) + pref.g_grad = hex2num(copytext(new_grad, 4, 6)) + pref.b_grad = hex2num(copytext(new_grad, 6, 8)) + return TOPIC_REFRESH_UPDATE_PREVIEW else if(href_list["hair_style"]) var/list/valid_hairstyles = pref.get_valid_hairstyles() @@ -480,6 +510,14 @@ var/global/list/valid_bloodtypes = list("A+", "A-", "B+", "B-", "AB+", "AB-", "O if(new_h_style && CanUseTopic(user)) pref.h_style = new_h_style return TOPIC_REFRESH_UPDATE_PREVIEW + + else if(href_list["grad_style"]) + var/list/valid_gradients = GLOB.hair_gradients + + var/new_grad_style = input(user, "Choose a color pattern for your hair:", "Character Preference", pref.grad_style) as null|anything in valid_gradients + if(new_grad_style && CanUseTopic(user)) + pref.grad_style = new_grad_style + return TOPIC_REFRESH_UPDATE_PREVIEW else if(href_list["hair_style_left"]) var/H = href_list["hair_style_left"] diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 47384f09fa..4d2157306f 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -37,6 +37,10 @@ datum/preferences var/r_hair = 0 //Hair color var/g_hair = 0 //Hair color var/b_hair = 0 //Hair color + var/grad_style = "none" //Gradient style + 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/r_facial = 0 //Face hair color var/g_facial = 0 //Face hair color diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index 57206c05e2..eae3c47335 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -48,6 +48,21 @@ update_hair() return 1 + +/mob/living/carbon/human/proc/change_hair_gradient(var/hair_gradient) + if(!hair_gradient) + return + + if(grad_style == hair_gradient) + return + + if(!(hair_gradient in GLOB.hair_gradients)) + return + + grad_style = hair_gradient + + update_hair() + return 1 /mob/living/carbon/human/proc/change_facial_hair(var/facial_hair_style) if(!facial_hair_style) @@ -104,6 +119,17 @@ update_hair() return 1 + +/mob/living/carbon/human/proc/change_grad_color(var/red, var/green, var/blue) + if(red == r_grad && green == g_grad && blue == b_grad) + return + + r_grad = red + g_grad = green + b_grad = blue + + update_hair() + return 1 /mob/living/carbon/human/proc/change_facial_hair_color(var/red, var/green, var/blue) if(red == r_facial && green == g_facial && blue == b_facial) diff --git a/code/modules/mob/living/carbon/human/gradient.dm b/code/modules/mob/living/carbon/human/gradient.dm new file mode 100644 index 0000000000..7a0e1d37f1 --- /dev/null +++ b/code/modules/mob/living/carbon/human/gradient.dm @@ -0,0 +1,6 @@ +GLOBAL_LIST_INIT(hair_gradients, list( + "None" = "none", + "Fade (Up)" = "fadeup", + "Fade (Down)" = "fadedown", + "Vertical Split" = "vsplit" + )) \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 18e0babf42..1e75583173 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -4,6 +4,12 @@ var/g_hair = 0 var/b_hair = 0 var/h_style = "Bald" + + //Hair gradient color and styles + var/r_grad = 0 + var/g_grad = 0 + var/b_grad = 0 + var/grad_style = "none" //Facial hair colour and style var/r_facial = 0 diff --git a/code/modules/mob/living/carbon/human/species/species_shapeshift.dm b/code/modules/mob/living/carbon/human/species/species_shapeshift.dm index 6629a96a9f..414e819eeb 100644 --- a/code/modules/mob/living/carbon/human/species/species_shapeshift.dm +++ b/code/modules/mob/living/carbon/human/species/species_shapeshift.dm @@ -88,6 +88,7 @@ var/list/wrapped_species_by_ref = list() var/list/valid_hairstyles = list() var/list/valid_facialhairstyles = list() + var/list/valid_gradstyles = GLOB.hair_gradients for(var/hairstyle in hair_styles_list) var/datum/sprite_accessory/S = hair_styles_list[hairstyle] if(gender == MALE && S.gender == FEMALE) @@ -112,6 +113,9 @@ var/list/wrapped_species_by_ref = list() if(valid_hairstyles.len) var/new_hair = input("Select a hairstyle.", "Shapeshifter Hair") as null|anything in valid_hairstyles change_hair(new_hair ? new_hair : "Bald") + if(valid_gradstyles.len) + var/new_hair = input("Select a hair gradient style.", "Shapeshifter Hair") as null|anything in valid_gradstyles + change_hair_gradient(new_hair ? new_hair : "None") if(valid_facialhairstyles.len) var/new_hair = input("Select a facial hair style.", "Shapeshifter Hair") as null|anything in valid_facialhairstyles change_facial_hair(new_hair ? new_hair : "Shaved") @@ -216,6 +220,12 @@ var/list/wrapped_species_by_ref = list() if(!new_hair) return shapeshifter_set_hair_color(new_hair) + + var/new_grad = input("Please select a new hair gradient color.", "Hair Gradient Colour") as color + if(!new_grad) + return + shapeshifter_set_grad_color(new_grad) + var/new_fhair = input("Please select a new facial hair color.", "Facial Hair Color") as color if(!new_fhair) return @@ -224,6 +234,10 @@ var/list/wrapped_species_by_ref = list() /mob/living/carbon/human/proc/shapeshifter_set_hair_color(var/new_hair) change_hair_color(hex2num(copytext(new_hair, 2, 4)), hex2num(copytext(new_hair, 4, 6)), hex2num(copytext(new_hair, 6, 8))) + +/mob/living/carbon/human/proc/shapeshifter_set_grad_color(var/new_grad) + + change_grad_color(hex2num(copytext(new_grad, 2, 4)), hex2num(copytext(new_grad, 4, 6)), hex2num(copytext(new_grad, 6, 8))) /mob/living/carbon/human/proc/shapeshifter_set_facial_color(var/new_fhair) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 05031e9855..adc97ba258 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -431,11 +431,18 @@ var/global/list/damage_icon_parts = list() //see UpdateDamageIcon() hair_style = hair_styles_list["Short Hair"] if(hair_style && (src.species.get_bodytype(src) in hair_style.species_allowed)) + var/icon/grad_s = null var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s") var/icon/hair_s_add = new/icon("icon" = hair_style.icon_add, "icon_state" = "[hair_style.icon_state]_s") if(hair_style.do_colouration) + if(grad_style) + grad_s = new/icon("icon" = 'icons/mob/hair_gradients.dmi', "icon_state" = GLOB.hair_gradients[grad_style]) + 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), ICON_MULTIPLY) hair_s.Blend(hair_s_add, ICON_ADD) + if(!isnull(grad_s)) + hair_s.Blend(grad_s, ICON_OVERLAY) face_standing.Blend(hair_s, ICON_OVERLAY) diff --git a/icons/mob/hair_gradients.dmi b/icons/mob/hair_gradients.dmi new file mode 100644 index 0000000000..0f40b098e9 Binary files /dev/null and b/icons/mob/hair_gradients.dmi differ diff --git a/vorestation.dme b/vorestation.dme index 40a9378890..00c4434fcc 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -2585,6 +2585,7 @@ #include "code\modules\mob\living\carbon\human\emote_vr.dm" #include "code\modules\mob\living\carbon\human\examine.dm" #include "code\modules\mob\living\carbon\human\examine_vr.dm" +#include "code\modules\mob\living\carbon\human\gradient.dm" #include "code\modules\mob\living\carbon\human\human.dm" #include "code\modules\mob\living\carbon\human\human_attackhand.dm" #include "code\modules\mob\living\carbon\human\human_attackhand_vr.dm"