mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Created global lists for hair and facial_hair datums since they are referenced frequently. This means those datums are only ever created once. Also, the list is indexed by hairstyle name. This means means we only need to store one variable to find the hair datum. It also means admins can change h_style and f_style to the name of the hair and use the Regenerate Icons function in viewvars to update a human's hair icon. If an incorrect f_style or h_style is input it won't affect anything adversely (besides hair not showing for that mob).
The hub will no longer report admins who are stealthminning. Added a server byond_version check. All it does is tell you if your byond_version is below RECOMMENDED_VERSION and encourages you to update BYOND. Underwear and bag lists are now a single global list rather than creating the same list for every new player. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4268 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -2048,7 +2048,7 @@ var/global/BSACooldown = 0
|
||||
feedback_inc("admin_secrets_fun_used",1)
|
||||
feedback_add_details("admin_secrets_fun_used","DF")
|
||||
for(var/mob/living/carbon/human/B in mob_list)
|
||||
B.face_icon_state = "facial_wise"
|
||||
B.f_style = "Dward Beard"
|
||||
B.update_hair()
|
||||
message_admins("[key_name_admin(usr)] activated dorf mode")
|
||||
else
|
||||
|
||||
@@ -72,10 +72,10 @@
|
||||
/mob/living/carbon/human/proc/ChangeToHusk()
|
||||
if(HUSK in mutations) return
|
||||
|
||||
if(facial_hair_style)
|
||||
facial_hair_style.icon_state = "bald" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE
|
||||
if(hair_style)
|
||||
hair_style.icon_state = "bald"
|
||||
if(f_style)
|
||||
f_style = "Shaved" //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE
|
||||
if(h_style)
|
||||
h_style = "Bald"
|
||||
update_hair(0)
|
||||
|
||||
mutations.Add(HUSK)
|
||||
|
||||
@@ -1,29 +1,25 @@
|
||||
/mob/living/carbon/human
|
||||
|
||||
//Hair colour and style
|
||||
var/r_hair = 0.0
|
||||
var/g_hair = 0.0
|
||||
var/b_hair = 0.0
|
||||
var/h_style = "Short Hair"
|
||||
var/datum/sprite_accessory/hair/hair_style
|
||||
var/hair_icon_state = "hair_a"
|
||||
var/r_hair = 0
|
||||
var/g_hair = 0
|
||||
var/b_hair = 0
|
||||
var/h_style = "Bald"
|
||||
|
||||
//Facial hair colour and style
|
||||
var/r_facial = 0.0
|
||||
var/g_facial = 0.0
|
||||
var/b_facial = 0.0
|
||||
var/r_facial = 0
|
||||
var/g_facial = 0
|
||||
var/b_facial = 0
|
||||
var/f_style = "Shaved"
|
||||
var/datum/sprite_accessory/facial_hair/facial_hair_style
|
||||
var/face_icon_state = "bald"
|
||||
|
||||
//Eye colour
|
||||
var/r_eyes = 0.0
|
||||
var/g_eyes = 0.0
|
||||
var/b_eyes = 0.0
|
||||
var/r_eyes = 0
|
||||
var/g_eyes = 0
|
||||
var/b_eyes = 0
|
||||
|
||||
var/s_tone = 0.0 //Skin tone
|
||||
var/s_tone = 0 //Skin tone
|
||||
|
||||
var/age = 30.0 //Player's age (pure fluff)
|
||||
var/age = 30 //Player's age (pure fluff)
|
||||
var/b_type = "A+" //Player's bloodtype (Not currently used, just character fluff)
|
||||
|
||||
var/underwear = 1 //Which underwear the player wants
|
||||
|
||||
@@ -241,21 +241,25 @@ Please contact me on #coderbus IRC. ~Carn x
|
||||
var/icon/face_standing = new /icon('icons/mob/human_face.dmi',"bald_s")
|
||||
var/icon/face_lying = new /icon('icons/mob/human_face.dmi',"bald_l")
|
||||
|
||||
if(facial_hair_style)
|
||||
var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
|
||||
var/icon/facial_l = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l")
|
||||
facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
|
||||
facial_l.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
|
||||
face_standing.Blend(facial_s, ICON_OVERLAY)
|
||||
face_lying.Blend(facial_l, ICON_OVERLAY)
|
||||
if(f_style)
|
||||
var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[f_style]
|
||||
if(facial_hair_style)
|
||||
var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
|
||||
var/icon/facial_l = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_l")
|
||||
facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
|
||||
facial_l.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
|
||||
face_standing.Blend(facial_s, ICON_OVERLAY)
|
||||
face_lying.Blend(facial_l, ICON_OVERLAY)
|
||||
|
||||
if(hair_style)
|
||||
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
|
||||
var/icon/hair_l = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l")
|
||||
hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)
|
||||
hair_l.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)
|
||||
face_standing.Blend(hair_s, ICON_OVERLAY)
|
||||
face_lying.Blend(hair_l, ICON_OVERLAY)
|
||||
if(h_style)
|
||||
var/datum/sprite_accessory/hair_style = hair_styles_list[h_style]
|
||||
if(hair_style)
|
||||
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
|
||||
var/icon/hair_l = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_l")
|
||||
hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)
|
||||
hair_l.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)
|
||||
face_standing.Blend(hair_s, ICON_OVERLAY)
|
||||
face_lying.Blend(hair_l, ICON_OVERLAY)
|
||||
|
||||
overlays_lying[HAIR_LAYER] = image(face_lying)
|
||||
overlays_standing[HAIR_LAYER] = image(face_standing)
|
||||
|
||||
@@ -17,6 +17,10 @@ var/global/list/special_roles = list( //keep synced with the defines BE_* in set
|
||||
"infested monkey" = IS_MODE_COMPILED("monkey"), // 9
|
||||
)
|
||||
|
||||
var/global/list/underwear_m = list("White", "Grey", "Green", "Blue", "Black", "Mankini", "Love-Hearts", "Black2", "Grey2", "Stripey", "Kinky", "None") //Curse whoever made male/female underwear diffrent colours
|
||||
var/global/list/underwear_f = list("Red", "White", "Yellow", "Blue", "Black", "Thong", "Babydoll", "Baby-Blue", "Green", "Pink", "Kinky", "None")
|
||||
var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel")
|
||||
|
||||
var/const/BE_TRAITOR =(1<<0)
|
||||
var/const/BE_OPERATIVE =(1<<1)
|
||||
var/const/BE_CHANGELING=(1<<2)
|
||||
@@ -53,14 +57,10 @@ datum/preferences
|
||||
//Just like it sounds
|
||||
var/ooccolor = "#b82e00"
|
||||
var/underwear = 1
|
||||
var/list/underwear_m = list("White", "Grey", "Green", "Blue", "Black", "Mankini", "Love-Hearts", "Black2", "Grey2", "Stripey", "Kinky", "None") //Curse whoever made male/female underwear diffrent colours
|
||||
var/list/underwear_f = list("Red", "White", "Yellow", "Blue", "Black", "Thong", "Babydoll", "Baby-Blue", "Green", "Pink", "Kinky", "None")
|
||||
var/backbag = 2
|
||||
var/list/backbaglist = list("Nothing", "Backpack", "Satchel")
|
||||
|
||||
//Hair type
|
||||
var/h_style = "Short Hair"
|
||||
var/datum/sprite_accessory/hair/hair_style
|
||||
var/h_style = "Bald"
|
||||
//Hair color
|
||||
var/r_hair = 0
|
||||
var/g_hair = 0
|
||||
@@ -68,7 +68,6 @@ datum/preferences
|
||||
|
||||
//Face hair type
|
||||
var/f_style = "Shaved"
|
||||
var/datum/sprite_accessory/facial_hair/facial_hair_style
|
||||
//Face hair color
|
||||
var/r_facial = 0
|
||||
var/g_facial = 0
|
||||
@@ -116,8 +115,6 @@ datum/preferences
|
||||
|
||||
|
||||
New()
|
||||
hair_style = new/datum/sprite_accessory/hair/short
|
||||
facial_hair_style = new/datum/sprite_accessory/facial_hair/shaved
|
||||
randomize_name()
|
||||
..()
|
||||
|
||||
@@ -557,33 +554,10 @@ datum/preferences
|
||||
// see preferences_setup.dm for proc
|
||||
|
||||
if("input") // input hair selection
|
||||
|
||||
// Generate list of hairs via typesof()
|
||||
var/list/all_hairs = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair
|
||||
|
||||
// List of hair names
|
||||
var/list/hairs = list()
|
||||
|
||||
// loop through potential hairs
|
||||
for(var/x in all_hairs)
|
||||
var/datum/sprite_accessory/hair/H = new x // create new hair datum based on type x
|
||||
hairs.Add(H.name) // add hair name to hairs
|
||||
del(H) // delete the hair after it's all done
|
||||
|
||||
// prompt the user for a hair selection, the selection being anything in list hairs
|
||||
var/new_style = input(user, "Select a hair style", "Character Generation") as null|anything in hairs
|
||||
|
||||
// if new style selected (not cancel)
|
||||
var/new_style = input(user, "Select a hair style", "Character Generation") as null|anything in hair_styles_list
|
||||
if(new_style)
|
||||
h_style = new_style
|
||||
|
||||
for(var/x in all_hairs) // loop through all_hairs again. Might be slightly CPU expensive, but not significantly.
|
||||
var/datum/sprite_accessory/hair/H = new x // create new hair datum
|
||||
if(H.name == new_style)
|
||||
hair_style = H // assign the hair_style variable a new hair datum
|
||||
break
|
||||
else
|
||||
del(H) // if hair H not used, delete. BYOND can garbage collect, but better safe than sorry
|
||||
|
||||
if(link_tags["ooccolor"])
|
||||
var/ooccolor = input(user, "Please select OOC colour.", "OOC colour") as color
|
||||
@@ -599,28 +573,12 @@ datum/preferences
|
||||
|
||||
// see above for commentation. This is just a slight modification of the hair code for facial hairs
|
||||
if("random")
|
||||
|
||||
randomize_facial(gender)
|
||||
|
||||
if("input")
|
||||
|
||||
var/list/all_fhairs = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair
|
||||
var/list/fhairs = list()
|
||||
for(var/x in all_fhairs)
|
||||
var/datum/sprite_accessory/facial_hair/H = new x
|
||||
fhairs.Add(H.name)
|
||||
del(H)
|
||||
|
||||
var/new_style = input(user, "Select a facial hair style", "Character Generation") as null|anything in fhairs
|
||||
var/new_style = input(user, "Select a facial hair style", "Character Generation") as null|anything in facial_hair_styles_list
|
||||
if(new_style)
|
||||
f_style = new_style
|
||||
for(var/x in all_fhairs)
|
||||
var/datum/sprite_accessory/facial_hair/H = new x
|
||||
if(H.name == new_style)
|
||||
facial_hair_style = H
|
||||
break
|
||||
else
|
||||
del(H)
|
||||
|
||||
if(link_tags["gender"])
|
||||
if(gender == MALE)
|
||||
@@ -788,9 +746,6 @@ datum/preferences
|
||||
else
|
||||
character.UI = 'icons/mob/screen1_Midnight.dmi'
|
||||
|
||||
character.hair_style = hair_style
|
||||
character.facial_hair_style = facial_hair_style
|
||||
|
||||
if(underwear > 12 || underwear < 1)
|
||||
underwear = 1 //I'm sure this is 100% unnecessary, but I'm paranoid... sue me.
|
||||
character.underwear = underwear
|
||||
|
||||
@@ -26,47 +26,11 @@ datum/preferences
|
||||
return
|
||||
|
||||
proc/randomize_hair(var/gender)
|
||||
// Generate list of all possible hairs via typesof(), subtract the parent type however
|
||||
var/list/all_hairs = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair
|
||||
h_style = pick(hair_styles_list)
|
||||
|
||||
// List of hair datums. Used in pick() to select random hair
|
||||
var/list/hairs = list()
|
||||
|
||||
// Loop through potential hairs
|
||||
for(var/x in all_hairs)
|
||||
var/datum/sprite_accessory/hair/H = new x // create new hair datum based on type x
|
||||
|
||||
if(gender == FEMALE && H.choose_female) // if female and hair is female-suitable, add to possible hairs
|
||||
hairs.Add(H)
|
||||
|
||||
else if(gender != FEMALE && H.choose_male) // if male and hair is male-suitable, add to hairs
|
||||
hairs.Add(H)
|
||||
|
||||
else
|
||||
del(H) // delete if incompatible
|
||||
|
||||
if(hairs.len > 0) // if hairs could be generated
|
||||
hair_style = pick(hairs) // assign random hair
|
||||
h_style = hair_style.name
|
||||
|
||||
proc/randomize_facial() // uncommented, see randomize_hair() for commentation
|
||||
var/list/all_fhairs = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair
|
||||
|
||||
var/list/fhairs = list()
|
||||
|
||||
for(var/x in all_fhairs)
|
||||
var/datum/sprite_accessory/facial_hair/H = new x
|
||||
|
||||
if(gender == FEMALE && H.choose_female)
|
||||
fhairs.Add(H)
|
||||
else if(gender != FEMALE && H.choose_male)
|
||||
fhairs.Add(H)
|
||||
else
|
||||
del(H)
|
||||
|
||||
if(fhairs.len > 0)
|
||||
facial_hair_style = pick(fhairs)
|
||||
f_style = facial_hair_style.name
|
||||
f_style = pick(facial_hair_styles_list)
|
||||
|
||||
proc/randomize_skin_tone()
|
||||
var/tone
|
||||
@@ -138,7 +102,7 @@ datum/preferences
|
||||
green = max(min(green + rand (-25, 25), 255), 0)
|
||||
blue = max(min(blue + rand (-25, 25), 255), 0)
|
||||
|
||||
switch (target)
|
||||
switch(target)
|
||||
if ("hair")
|
||||
r_hair = red
|
||||
g_hair = green
|
||||
@@ -222,20 +186,20 @@ datum/preferences
|
||||
var/icon/eyes_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = "eyes_s")
|
||||
eyes_s.Blend(rgb(r_eyes, g_eyes, b_eyes), ICON_ADD)
|
||||
|
||||
|
||||
// Hair and facial hair, improved by Doohl
|
||||
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
|
||||
hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)
|
||||
|
||||
var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
|
||||
facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
|
||||
|
||||
var/datum/sprite_accessory/hair_style = hair_styles_list[h_style]
|
||||
if(hair_style)
|
||||
var/icon/hair_s = new/icon("icon" = hair_style.icon, "icon_state" = "[hair_style.icon_state]_s")
|
||||
hair_s.Blend(rgb(r_hair, g_hair, b_hair), ICON_ADD)
|
||||
eyes_s.Blend(hair_s, ICON_OVERLAY)
|
||||
|
||||
var/icon/mouth_s = new/icon("icon" = 'icons/mob/human_face.dmi', "icon_state" = "mouth_[g]_s")
|
||||
|
||||
eyes_s.Blend(hair_s, ICON_OVERLAY)
|
||||
eyes_s.Blend(mouth_s, ICON_OVERLAY)
|
||||
eyes_s.Blend(facial_s, ICON_OVERLAY)
|
||||
|
||||
var/datum/sprite_accessory/facial_hair_style = facial_hair_styles_list[f_style]
|
||||
if(facial_hair_style)
|
||||
var/icon/facial_s = new/icon("icon" = facial_hair_style.icon, "icon_state" = "[facial_hair_style.icon_state]_s")
|
||||
facial_s.Blend(rgb(r_facial, g_facial, b_facial), ICON_ADD)
|
||||
eyes_s.Blend(facial_s, ICON_OVERLAY)
|
||||
|
||||
var/icon/clothes_s = null
|
||||
if(job_civilian_low & ASSISTANT)//This gives the preview icon clothes depending on which job(if any) is set to 'high'
|
||||
@@ -532,27 +496,7 @@ datum/preferences
|
||||
|
||||
del(preview_icon)
|
||||
del(mouth_s)
|
||||
del(facial_s)
|
||||
del(hair_s)
|
||||
del(eyes_s)
|
||||
del(clothes_s)
|
||||
|
||||
|
||||
proc/style_to_datum()
|
||||
// use h_style and f_style to load /datum hairs
|
||||
|
||||
// hairs
|
||||
for(var/x in typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair)
|
||||
var/datum/sprite_accessory/hair/H = new x
|
||||
if(H.name == h_style)
|
||||
hair_style = H
|
||||
else
|
||||
del(H)
|
||||
|
||||
// facial hairs
|
||||
for(var/x in typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair)
|
||||
var/datum/sprite_accessory/facial_hair/H = new x
|
||||
if(H.name == f_style)
|
||||
facial_hair_style = H
|
||||
else
|
||||
del(H)
|
||||
@@ -188,8 +188,6 @@ datum/preferences/proc/savefile_load(mob/user)
|
||||
if(version && version < SAVEFILE_VERSION_MAX)
|
||||
convert_hairstyles() // convert version 4 hairstyles to version 5
|
||||
|
||||
style_to_datum() // convert f_style and h_style to /datum
|
||||
|
||||
return 1
|
||||
|
||||
#undef SAVEFILE_VERSION_MAX
|
||||
|
||||
Reference in New Issue
Block a user