diff --git a/code/defines/procs/global_lists.dm b/code/defines/procs/global_lists.dm index e22f6cfa3f..7e17b8cb5e 100644 --- a/code/defines/procs/global_lists.dm +++ b/code/defines/procs/global_lists.dm @@ -8,12 +8,27 @@ var/global/list/living_mob_list = list()//List of all living mobs, including cli var/global/list/dead_mob_list = list()//List of all dead mobs, including clientless var/global/list/client_list = list()//List of all clients, based on ckey var/global/list/cable_list = list()//Index for all cables, so that powernets don't have to look through the entire world all the time +var/global/list/hair_styles_list = list() //stores /datum/sprite_accessory/hair indexed by name +var/global/list/facial_hair_styles_list = list() //stores /datum/sprite_accessory/facial_hair indexed by name ////////////////////////// /////Initial Building///// ////////////////////////// //Realistically, these should never be run, but ideally, they should only be run once at round-start +/proc/make_datum_references_lists() + var/list/paths + //Hair - Initialise all /datum/sprite_accessory/hair into an list indexed by hair-style name + paths = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair + for(var/path in paths) + var/datum/sprite_accessory/hair/H = new path() + hair_styles_list[H.name] = H + //Facial Hair - Initialise all /datum/sprite_accessory/facial_hair into an list indexed by facialhair-style name + paths = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair + for(var/path in paths) + var/datum/sprite_accessory/facial_hair/H = new path() + facial_hair_styles_list[H.name] = H + proc/make_player_list()//Global proc that rebuilds the player list for(var/mob/p in player_list)//Clears out everyone that logged out if(!(p.client)) diff --git a/code/game/algorithm.dm b/code/game/algorithm.dm index 61b0a3bcae..2075beedb6 100644 --- a/code/game/algorithm.dm +++ b/code/game/algorithm.dm @@ -1,7 +1,10 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 +#define RECOMMENDED_VERSION 494 /world/New() ..() + if(byond_version < RECOMMENDED_VERSION) + world.log << "Your server's byond version does not meet the recommended requirements for TGstation code. Please update BYOND" diary = file("data/logs/[time2text(world.realtime, "YYYY/MM-Month/DD-Day")].log") diary << {" @@ -22,8 +25,9 @@ Starting up. [time2text(world.timeofday, "hh:mm.ss")] jobban_loadbanfile() jobban_updatelegacybans() LoadBans() - process_teleport_locs() //Sets up the wizard teleport locations - process_ghost_teleport_locs() //Sets up ghost teleport locations. + make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once) + process_teleport_locs() //Sets up the wizard teleport locations + process_ghost_teleport_locs() //Sets up ghost teleport locations. sleep_offline = 1 spawn(3000) //so we aren't adding to the round-start lag @@ -32,6 +36,7 @@ Starting up. [time2text(world.timeofday, "hh:mm.ss")] if(config.kick_inactive) KickInactiveClients() +#undef RECOMMENDED_VERSION #define INACTIVITY_KICK 6000 //10 minutes in ticks (approx.) /world/proc/KickInactiveClients() for(var/client/C) @@ -42,6 +47,7 @@ Starting up. [time2text(world.timeofday, "hh:mm.ss")] C << "\red You have been inactive for more than 10 minutes and have been disconnected." del(C) spawn(3000) KickInactiveClients()//more or less five minutes +#undef INACTIVITY_KICK /// EXPERIMENTAL STUFF diff --git a/code/game/dna.dm b/code/game/dna.dm index 9d7141ad3f..7a3a7e1331 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -10,37 +10,26 @@ if(length(uni_identity) != 39) //Lazy. var/temp - var/hair = 0 - var/beard - // determine DNA fragment from hairstyle - // :wtc: + //Hair + var/hair = 0 + if(!character.h_style) + character.h_style = "Skinhead" + var/hrange = round(4095 / hair_styles_list.len) + var/index = hair_styles_list.Find(character.h_style) + if(index) + hair = index * hrange - rand(1,hrange-1) - // If the character doesn't have initialized hairstyles / beardstyles, initialize it for them! - if(!character.hair_style) - character.hair_style = new/datum/sprite_accessory/hair/short + //Facial Hair + var/beard = 0 + if(!character.f_style) + character.f_style = "Shaved" - if(!character.facial_hair_style) - character.facial_hair_style = new/datum/sprite_accessory/facial_hair/shaved - - var/list/styles = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair - var/hrange = round(4095 / styles.len) - - if(character.hair_style) - var/style = styles.Find(character.hair_style.type) - if(style) - hair = style * hrange - rand(1,hrange-1) - - // Beard dna code - mostly copypasted from hair code to allow for more dynamic facial hair style additions - var/list/face_styles = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair - var/f_hrange = round(4095 / face_styles.len) - - var/f_style = face_styles.Find(character.facial_hair_style.type) - if(f_style) - beard = f_style * f_hrange - rand(1,f_hrange-1) - else - beard = 0 + var/f_hrange = round(4095 / facial_hair_styles_list.len) + index = facial_hair_styles_list.Find(character.f_style) + if(index) + beard = index * f_hrange - rand(1,f_hrange-1) temp = add_zero2(num2hex((character.r_hair),1), 3) temp += add_zero2(num2hex((character.b_hair),1), 3) @@ -78,32 +67,27 @@ if(length(struc_enzymes)!= 42) struc_enzymes = "0983E840344C39F4B059D5145FC5785DC6406A4000" /datum/dna/proc/ready_dna(mob/living/carbon/human/character) - var/temp - var/hair - var/beard - // determine DNA fragment from hairstyle - // :wtc: + //Hair + var/hair = 0 + if(!character.h_style) + character.h_style = "Bald" - var/list/styles = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair - var/hrange = round(4095 / styles.len) + var/hrange = round(4095 / hair_styles_list.len) + var/index = hair_styles_list.Find(character.h_style) + if(index) + hair = index * hrange - rand(1,hrange-1) - var/style = styles.Find(character.hair_style.type) - if(style) - hair = style * hrange - rand(1,hrange-1) - else - hair = 0 + //Facial Hair + var/beard = 0 + if(!character.f_style) + character.f_style = "Shaved" - // Beard dna code - mostly copypasted from hair code to allow for more dynamic facial hair style additions - var/list/face_styles = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair - var/f_hrange = round(4095 / face_styles.len) - - var/f_style = face_styles.Find(character.facial_hair_style.type) - if(f_style) - beard = f_style * f_hrange - rand(1,f_hrange-1) - else - beard = 0 + var/f_hrange = round(4095 / facial_hair_styles_list.len) + index = facial_hair_styles_list.Find(character.f_style) + if(index) + beard = index * f_hrange - rand(1,f_hrange-1) temp = add_zero2(num2hex((character.r_hair),1), 3) temp += add_zero2(num2hex((character.b_hair),1), 3) @@ -378,32 +362,17 @@ else H.gender = MALE - - /// BEARDS - - var/beardnum = hex2num(getblock(structure,12,3)) - var/list/facial_styles = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair - var/fstyle = round(1 +(beardnum / 4096)*facial_styles.len) - - var/fpath = text2path("[facial_styles[fstyle]]") - var/datum/sprite_accessory/facial_hair/fhair = new fpath - - H.face_icon_state = fhair.icon_state - H.f_style = fhair.icon_state - H.facial_hair_style = fhair - - - // HAIR + //Hair var/hairnum = hex2num(getblock(structure,13,3)) - var/list/styles = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair - var/style = round(1 +(hairnum / 4096)*styles.len) + var/index = round(1 +(hairnum / 4096)*hair_styles_list.len) + if((0 < index) && (index <= hair_styles_list.len)) + H.h_style = hair_styles_list[index] - var/hpath = text2path("[styles[style]]") - var/datum/sprite_accessory/hair/hair = new hpath - - H.hair_icon_state = hair.icon_state - H.h_style = hair.icon_state - H.hair_style = hair + //Facial Hair + var/beardnum = hex2num(getblock(structure,12,3)) + index = round(1 +(beardnum / 4096)*facial_hair_styles_list.len) + if((0 < index) && (index <= facial_hair_styles_list.len)) + H.f_style = facial_hair_styles_list[index] H.update_body(0) H.update_hair() diff --git a/code/game/objects/mirror.dm b/code/game/objects/mirror.dm index f2ed88418f..23de5511ef 100644 --- a/code/game/objects/mirror.dm +++ b/code/game/objects/mirror.dm @@ -18,41 +18,15 @@ //handle facial hair (if necessary) if(H.gender == MALE) - var/list/all_fhairs = typesof(/datum/sprite_accessory/facial_hair) - /datum/sprite_accessory/facial_hair //this would probably be better as a global list - var/list/fhairs = list() - for(var/x in all_fhairs) - var/datum/sprite_accessory/facial_hair/F = new x //this goes for the original in preferences too, but it'd - fhairs.Add(F.name) //be nice to avoid all this instantiation and deletion... - del(F) - - var/new_style = input(user, "Select a facial hair style", "Grooming") as null|anything in fhairs + var/new_style = input(user, "Select a facial hair style", "Grooming") as null|anything in facial_hair_styles_list if(userloc != H.loc) return //no tele-grooming if(new_style) - for(var/x in all_fhairs) - var/datum/sprite_accessory/facial_hair/F = new x - if(F.name == new_style) - H.facial_hair_style.icon_state = F.icon_state //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE - break - else - del(F) + H.f_style = new_style //handle normal hair - var/list/all_hairs = typesof(/datum/sprite_accessory/hair) - /datum/sprite_accessory/hair //this would probably be better as a global list - var/list/hairs = list() - for(var/x in all_hairs) - var/datum/sprite_accessory/facial_hair/F = new x - hairs.Add(F.name) - del(F) - - var/new_style = input(user, "Select a hair style", "Grooming") as null|anything in hairs + var/new_style = input(user, "Select a hair style", "Grooming") as null|anything in hair_styles_list if(userloc != H.loc) return //no tele-grooming if(new_style) - for(var/x in all_hairs) - var/datum/sprite_accessory/hair/F = new x - if(F.name == new_style) - H.hair_style.icon_state = F.icon_state //we only change the icon_state of the hair datum, so it doesn't mess up their UI/UE - break - else - del(F) + H.h_style = new_style H.update_hair() \ No newline at end of file diff --git a/code/game/topic.dm b/code/game/topic.dm index 49dbbc1bc7..d16d38e904 100644 --- a/code/game/topic.dm +++ b/code/game/topic.dm @@ -27,15 +27,13 @@ var/n = 0 var/admins = 0 - for(var/mob/M in player_list) - - if(M.client) - if(M.client.holder) - if(!M.client.stealth) - admins++ - - s["player[n]"] = M.client.key - n++ + for(var/client/C in client_list) + if(C.holder) + if(C.stealth) + continue //so stealthmins aren't revealed by the hub + admins++ + s["player[n]"] = C.key + n++ s["players"] = n // 7 + s["players"] + 1 = index of s["revinfo"] diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index dcdad4f997..c69a8018df 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index a869acf499..3ab1826919 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -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) diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index ad2fb71a97..0143f418e6 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -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 diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index ee75f75798..9bedd8c35d 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -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) diff --git a/code/modules/mob/new_player/preferences.dm b/code/modules/mob/new_player/preferences.dm index f4ee783376..276faac9b7 100644 --- a/code/modules/mob/new_player/preferences.dm +++ b/code/modules/mob/new_player/preferences.dm @@ -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 diff --git a/code/modules/mob/new_player/preferences_setup.dm b/code/modules/mob/new_player/preferences_setup.dm index 15e360a0e5..bfbecc2de5 100644 --- a/code/modules/mob/new_player/preferences_setup.dm +++ b/code/modules/mob/new_player/preferences_setup.dm @@ -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) \ No newline at end of file diff --git a/code/modules/mob/new_player/savefile.dm b/code/modules/mob/new_player/savefile.dm index bca39d7fa5..6f111cb6cc 100644 --- a/code/modules/mob/new_player/savefile.dm +++ b/code/modules/mob/new_player/savefile.dm @@ -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