allows vox to change their hair colors (#31703)

* da files

* :/

* ????????????

* IT WERKS(tm)

* :)))

* g

* this makes hair dye work

* remove hitler, fix wrong hair color being selected

Co-authored-by: SonixApache <soniixapache@hotmail.com>
This commit is contained in:
rob
2022-02-03 21:53:15 -05:00
committed by GitHub
parent 795233165f
commit a978ffa610
8 changed files with 78 additions and 29 deletions

View File

@@ -129,6 +129,25 @@
else
return "unknown"
/proc/haircolordesc(v_hair)
switch(v_hair)
if("Green")
return "1"
if("Azure")
return "2"
if("Brown")
return "3"
if("Emerald")
return "4"
if("Gray")
return "5"
if("Light Green")
return "6"
if("Green-Brown")
return "7"
else
return "7"
/proc/age2agedescription(age)
switch(age)
if(0 to 1)

View File

@@ -264,14 +264,35 @@
/obj/item/weapon/hair_dye/proc/color_hair(mob/living/carbon/human/H, var/facial = 0)
if(!H)
return
if(facial)
H.my_appearance.r_facial = color_r
H.my_appearance.g_facial = color_g
H.my_appearance.b_facial = color_b
if(isvox(H))
var/list/voxhaircolorlist = list()
voxhaircolorlist["green"] = list(87, 123, 119)
voxhaircolorlist["brown"] = list(162,107,56)
voxhaircolorlist["grey"] = list(192, 192, 192)
voxhaircolorlist["lightgreen"] = list(132, 138, 64)
voxhaircolorlist["azure"] = list(112, 126, 93)
voxhaircolorlist["emerald"] = list(65, 136, 98)
voxhaircolorlist["greenbrown"] = list(147, 126, 61)
var/list/closest = ARBITRARILY_LARGE_NUMBER
var/voxcolor = 0
for(var/rgbcolorset in voxhaircolorlist)
var/rgb = voxhaircolorlist[rgbcolorset]
var/diff = (max(color_r,rgb[1]) - min(color_r,rgb[1])) + (max(color_r,rgb[2]) - min(color_r,rgb[2])) + (max(color_r,rgb[3]) - min(color_r,rgb[3]))
if(diff < closest)
closest = diff
var/haircolor = get_key_by_element(voxhaircolorlist, rgb)
voxcolor = voxhaircolorlist.Find(haircolor)
H.my_appearance.v_hair = voxcolor
else
H.my_appearance.r_hair = color_r
H.my_appearance.g_hair = color_g
H.my_appearance.b_hair = color_b
if(facial)
H.my_appearance.r_facial = color_r
H.my_appearance.g_facial = color_g
H.my_appearance.b_facial = color_b
else
H.my_appearance.r_hair = color_r
H.my_appearance.g_hair = color_g
H.my_appearance.b_hair = color_b
H.update_hair()
if(H.species.anatomy_flags & RGBSKINTONE)
H.update_body()

View File

@@ -142,6 +142,7 @@ var/const/MAX_SAVE_SLOTS = 16
var/underwear = 1 //underwear type
var/backbag = 2 //backpack type
var/h_style = "Bald" //Hair type
var/v_hair = 1 //Hair color for vox
var/r_hair = 0 //Hair color
var/g_hair = 0 //Hair color
var/b_hair = 0 //Hair color
@@ -1044,6 +1045,11 @@ NOTE: The change will take effect AFTER any current recruiting periods."}
r_hair = hex2num(copytext(new_hair, 2, 4))
g_hair = hex2num(copytext(new_hair, 4, 6))
b_hair = hex2num(copytext(new_hair, 6, 8))
if(species == "Vox")
var/new_hair_vox = input(user, "Choose your character's hair color:", "Character Preference") as null|anything in list("Green", "Azure", "Brown", "Emerald", "Gray", "Light Green", "Green-Brown")
if(new_hair_vox)
v_hair = haircolordesc(new_hair_vox)
to_chat(user,"Your hair will now be [new_hair_vox] in color.")
if(species == "Insectoid")
var/carapace = input(user, "Choose your character's carapace colour, color values will be adjusted to between 35 and 80:", "Character Preference", rgb(r_hair, g_hair, b_hair)) as color|null
if(carapace)
@@ -1054,7 +1060,7 @@ NOTE: The change will take effect AFTER any current recruiting periods."}
g_hair = clamp(g_hair, 0, 50)
b_hair = clamp(b_hair, 0, 35)
if("h_style")
var/new_h_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in valid_sprite_accessories(hair_styles_list, null, species) //gender intentionally left null so speshul snowflakes can cross-hairdress
var/new_h_style = input(user, "Choose your character's hair style:", "Character Preference") as null|anything in valid_sprite_accessories(hair_styles_list, null, species) //gender intentionally left null so speshul snowflakes can cross-hairdress
if(new_h_style)
h_style = new_h_style
@@ -1450,6 +1456,8 @@ Values up to 1000 are allowed.", "FPS", fps) as null|num
character.my_appearance.g_hair = g_hair
character.my_appearance.b_hair = b_hair
character.my_appearance.v_hair = v_hair
character.my_appearance.r_facial = r_facial
character.my_appearance.g_facial = g_facial
character.my_appearance.b_facial = b_facial

View File

@@ -10,6 +10,8 @@
// "Proper" to the appearance datum.
var/s_tone = 0
var/v_hair = 7
var/h_style = "Bald"
var/r_hair = 0
var/g_hair = 0
@@ -41,6 +43,7 @@
new_looks.h_style = h_style
new_looks.r_hair = r_hair
new_looks.g_hair = g_hair
new_looks.v_hair = v_hair
new_looks.f_style = f_style
new_looks.r_facial = r_facial
new_looks.g_facial = g_facial

View File

@@ -348,11 +348,15 @@ var/global/list/damage_icon_parts = list()
if(my_appearance.h_style && !(check_hidden_flags(get_clothing_items(),HIDEHEADHAIR))) //If the hair is hidden, don't draw it
var/datum/sprite_accessory/hair_style = hair_styles_list[my_appearance.h_style]
if((hair_style) && (src.species.name in hair_style.species_allowed))
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[hair_suffix]")
if(hair_style.do_colouration)
hair_s.Blend(rgb(my_appearance.r_hair, my_appearance.g_hair, my_appearance.b_hair), ICON_ADD)
if(hair_style.additional_accessories)
hair_s.Blend(icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_acc"), ICON_OVERLAY)
var/icon/hair_s
if(isvox(src))
hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[my_appearance.v_hair]_[hair_suffix]")
else
hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[hair_suffix]")
if(hair_style.do_colouration)
hair_s.Blend(rgb(my_appearance.r_hair, my_appearance.g_hair, my_appearance.b_hair), ICON_ADD)
if(hair_style.additional_accessories)
hair_s.Blend(icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_acc"), ICON_OVERLAY)
face_standing.Blend(hair_s, ICON_OVERLAY)
// else
//warning("Invalid my_appearance.h_style for [species.name]: [my_appearance.h_style]")

View File

@@ -21,6 +21,8 @@
/datum/preferences/proc/randomize_hair_color(var/target = "hair")
if(species == "Vox")
v_hair = rand(1,7)
if(prob (75) && target == "facial") // Chance to inherit hair color
r_facial = r_hair
g_facial = g_hair
@@ -31,7 +33,7 @@
var/green
var/blue
var/col = pick ("blonde", "black", "chestnut", "copper", "brown", "wheat", "old", 15;"punk")
var/col = pick("blonde", "black", "chestnut", "copper", "brown", "wheat", "old", 15;"punk")
switch(col)
if("blonde")
red = 255
@@ -242,7 +244,13 @@
eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD)
var/datum/sprite_accessory/hair_style = hair_styles_list[h_style]
if(hair_style)
if(species == "Vox")
if(hair_style)
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[v_hair]_s")
if(hair_style.additional_accessories)
hair_s.Blend(icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_[v_hair]_acc"), ICON_OVERLAY)
eyes_s.Blend(hair_s, ICON_OVERLAY)
else if(hair_style)
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
if(hair_style.do_colouration)
hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)

View File

@@ -939,85 +939,71 @@
name = "Short Vox Quills"
icon_state = "vox_shortquills"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_kingly
name = "Vox Kingly"
icon_state = "vox_kingly"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_afro
name = "Vox Afro"
icon_state = "vox_afro"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_mohawk
name = "Vox Mohawk"
icon_state = "vox_mohawk"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_yasu
name = "Vox Yasuhiro"
icon_state = "vox_yasu"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_horns
name = "Vox Quorns"
icon_state = "vox_horns"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_nights
name = "Vox Nights"
icon_state = "vox_nights"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_surf
name = "Vox Surf"
icon_state = "vox_surf"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_cropped
name = "Vox Cropped"
icon_state = "vox_cropped"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_bald
name = "Vox Bald"
icon_state = "vox_bald"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_ruffhawk
name = "Vox Ruffhawk"
icon_state = "vox_ruff_hawk"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_rows
name = "Vox Rows"
icon_state = "vox_rows"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_mange
name = "Vox Mange"
icon_state = "vox_mange"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/vox_quills_pony
name = "Vox Pony"
icon_state = "vox_pony"
species_allowed = list(VOX_SHAPED)
do_colouration = 0
/datum/sprite_accessory/hair/diona_popcorn
name = "Popped Hair"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 161 KiB