diff --git a/code/__HELPERS/mob_helpers.dm b/code/__HELPERS/mob_helpers.dm index 0c1a0900cd3..d99934ae92d 100644 --- a/code/__HELPERS/mob_helpers.dm +++ b/code/__HELPERS/mob_helpers.dm @@ -34,8 +34,7 @@ return pick(valid_picks) -/proc/random_hair_style(gender, species = "Human", datum/robolimb/robohead) - var/h_style = "Bald" +/proc/list_valid_hairstyles(species = "Human", datum/robolimb/robohead) var/list/valid_hairstyles = list() for(var/hairstyle in GLOB.hair_styles_public_list) var/datum/sprite_accessory/S = GLOB.hair_styles_public_list[hairstyle] @@ -55,14 +54,14 @@ else //If the user is not a species who can have robotic heads, use the default handling. if(species in S.species_allowed) //If the user's head is of a species the hairstyle allows, add it to the list. valid_hairstyles += hairstyle + return length(valid_hairstyles) ? sortTim(valid_hairstyles, GLOBAL_PROC_REF(cmp_text_asc)) : list("Bald") - if(length(valid_hairstyles)) - h_style = pick(valid_hairstyles) +/proc/random_hair_style(species = "Human", datum/robolimb/robohead) + var/list/valid_hairstyles = list_valid_hairstyles(species, robohead) - return h_style + return pick(valid_hairstyles) -/proc/random_facial_hair_style(gender, species = "Human", datum/robolimb/robohead) - var/f_style = "Shaved" +/proc/list_valid_facial_hairstyles(species = "Human", datum/robolimb/robohead) var/list/valid_facial_hairstyles = list() for(var/facialhairstyle in GLOB.facial_hair_styles_list) var/datum/sprite_accessory/S = GLOB.facial_hair_styles_list[facialhairstyle] @@ -83,10 +82,12 @@ if(species in S.species_allowed) //If the user's head is of a species the facial hair style allows, add it to the list. valid_facial_hairstyles += facialhairstyle - if(length(valid_facial_hairstyles)) - f_style = pick(valid_facial_hairstyles) + return length(valid_facial_hairstyles) ? sortTim(valid_facial_hairstyles, GLOBAL_PROC_REF(cmp_text_asc)) : list("Shaved") - return f_style +/proc/random_facial_hair_style(gender, species = "Human", datum/robolimb/robohead) + var/list/valid_facial_hairstyles = list_valid_facial_hairstyles(species, robohead) + + return pick(valid_facial_hairstyles) // it might be made species related, but it is pretty okay now /proc/random_hair_color(tint = TRUE, range) @@ -127,8 +128,7 @@ return rgb(R, G, B) -/proc/random_head_accessory(species = "Human") - var/ha_style = "None" +/proc/list_valid_head_accessories(species = "Human") var/list/valid_head_accessories = list() for(var/head_accessory in GLOB.head_accessory_styles_list) var/datum/sprite_accessory/S = GLOB.head_accessory_styles_list[head_accessory] @@ -137,13 +137,14 @@ continue valid_head_accessories += head_accessory - if(length(valid_head_accessories)) - ha_style = pick(valid_head_accessories) + return length(valid_head_accessories) ? sortTim(valid_head_accessories, GLOBAL_PROC_REF(cmp_text_asc)) : list("None") - return ha_style +/proc/random_head_accessory(species = "Human") + var/list/valid_head_accessories = list_valid_head_accessories(species) -/proc/random_marking_style(location = "body", species = "Human", datum/robolimb/robohead, body_accessory, alt_head) - var/m_style = "None" + return pick(valid_head_accessories) + +/proc/list_valid_marking_styles(location = "body", species = "Human", datum/robolimb/robohead, body_accessory, alt_head) var/list/valid_markings = list() for(var/marking in GLOB.marking_styles_list) var/datum/sprite_accessory/body_markings/S = GLOB.marking_styles_list[marking] @@ -176,10 +177,23 @@ continue valid_markings += marking - if(length(valid_markings)) - m_style = pick(valid_markings) + return length(valid_markings) ? sortTim(valid_markings, GLOBAL_PROC_REF(cmp_text_asc)) : list("None") - return m_style +/proc/random_marking_style(location = "body", species = "Human", datum/robolimb/robohead, body_accessory, alt_head) + var/list/valid_markings = list_valid_marking_styles(location, species, robohead, body_accessory, alt_head) + + return pick(valid_markings) + +/proc/list_valid_body_accessories(species = "Vulpkanin", is_optional = TRUE) + var/list/valid_body_accessories = list() + if(is_optional) + valid_body_accessories += null + + if(GLOB.body_accessory_by_species[species]) + for(var/name in GLOB.body_accessory_by_species[species]) + valid_body_accessories += name + + return length(valid_body_accessories) ? sortTim(valid_body_accessories, GLOBAL_PROC_REF(cmp_text_asc)) : null /** * Returns a random body accessory for a given species name. Can be null based on is_optional argument. @@ -189,13 +203,7 @@ * * is_optional - Whether *no* body accessory (null) is an option. */ /proc/random_body_accessory(species = "Vulpkanin", is_optional = TRUE) - var/list/valid_body_accessories = list() - if(is_optional) - valid_body_accessories += null - - if(GLOB.body_accessory_by_species[species]) - for(var/name in GLOB.body_accessory_by_species[species]) - valid_body_accessories += name + var/list/valid_body_accessories = list_valid_body_accessories(species, is_optional) return length(valid_body_accessories) ? pick(valid_body_accessories) : null diff --git a/code/datums/diseases/advance/symptoms/hair.dm b/code/datums/diseases/advance/symptoms/hair.dm index 34cd8e7dbf1..d3c7b001bf4 100644 --- a/code/datums/diseases/advance/symptoms/hair.dm +++ b/code/datums/diseases/advance/symptoms/hair.dm @@ -35,7 +35,7 @@ BONUS switch(A.stage) if(1, 2, 3) to_chat(H, SPAN_WARNING("Your scalp itches.")) - head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) else to_chat(H, SPAN_WARNING("Hair bursts forth from your scalp!")) var/datum/sprite_accessory/tmp_hair_style = GLOB.hair_styles_full_list["Very Long Hair"] @@ -43,5 +43,5 @@ BONUS if(head_organ.dna.species.name in tmp_hair_style.species_allowed) //If 'Very Long Hair' is a style the person's species can have, give it to them. head_organ.h_style = "Very Long Hair" else //Otherwise, give them a random hair style. - head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) H.update_hair() diff --git a/code/game/gamemodes/miniantags/tourist/tourist_arrivals.dm b/code/game/gamemodes/miniantags/tourist/tourist_arrivals.dm index 87301b2438f..1ff7f29892d 100644 --- a/code/game/gamemodes/miniantags/tourist/tourist_arrivals.dm +++ b/code/game/gamemodes/miniantags/tourist/tourist_arrivals.dm @@ -126,8 +126,8 @@ head_organ.sec_hair_colour = hair_c M.change_eye_color(eye_c) M.s_tone = skin_tone - head_organ.h_style = random_hair_style(M.gender, head_organ.dna.species.name) - head_organ.f_style = random_facial_hair_style(M.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) + head_organ.f_style = random_facial_hair_style(head_organ.dna.species.name) M.regenerate_icons() M.update_body() diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 1ecd3146265..dc56146a6dd 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -181,8 +181,8 @@ head_organ.sec_hair_colour = hair_c M.change_eye_color(eye_c) M.s_tone = skin_tone - head_organ.h_style = random_hair_style(M.gender, head_organ.dna.species.name) - head_organ.f_style = random_facial_hair_style(M.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) + head_organ.f_style = random_facial_hair_style(head_organ.dna.species.name) M.body_accessory = null M.regenerate_icons() M.update_body() diff --git a/code/modules/admin/verbs/deathsquad.dm b/code/modules/admin/verbs/deathsquad.dm index fee6b256c02..ca6e8e9d3bc 100644 --- a/code/modules/admin/verbs/deathsquad.dm +++ b/code/modules/admin/verbs/deathsquad.dm @@ -221,8 +221,8 @@ GLOBAL_VAR_INIT(deathsquad_sent, FALSE) head_organ.sec_hair_colour = hair_c new_commando.change_eye_color(eye_c) new_commando.s_tone = skin_tone - head_organ.h_style = random_hair_style(new_commando.gender, head_organ.dna.species.name) - head_organ.f_style = random_facial_hair_style(new_commando.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) + head_organ.f_style = random_facial_hair_style(head_organ.dna.species.name) new_commando.regenerate_icons() new_commando.update_body() diff --git a/code/modules/awaymissions/mob_spawn.dm b/code/modules/awaymissions/mob_spawn.dm index d5eab644e01..32bb9c30c2a 100644 --- a/code/modules/awaymissions/mob_spawn.dm +++ b/code/modules/awaymissions/mob_spawn.dm @@ -305,12 +305,12 @@ if(hair_style) D.h_style = hair_style else - D.h_style = random_hair_style(H.gender, D.dna.species.name) + D.h_style = random_hair_style(D.dna.species.name) if(facial_hair_style) D.f_style = facial_hair_style else if(H.gender != FEMALE) // no beard for women - D.f_style = random_facial_hair_style(H.gender, D.dna.species.name) + D.f_style = random_facial_hair_style(D.dna.species.name) if(hair_color) D.hair_colour = hair_color diff --git a/code/modules/client/preference/character.dm b/code/modules/client/preference/character.dm index 0b81396f463..662093b619c 100644 --- a/code/modules/client/preference/character.dm +++ b/code/modules/client/preference/character.dm @@ -652,7 +652,7 @@ s_tone = 35 - random_skin_tone(species) else if(S.bodyflags & HAS_ICON_SKIN_TONE) s_tone = random_skin_tone(species) - h_style = random_hair_style(gender, species, robohead) + h_style = random_hair_style(species, robohead) f_style = random_facial_hair_style(gender, species, robohead) if(!(S.bodyflags & BALD)) randomize_hair_color("hair") diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm index 98b6f45b165..f6566ade86a 100644 --- a/code/modules/client/preference/link_processing.dm +++ b/code/modules/client/preference/link_processing.dm @@ -106,7 +106,7 @@ if(!(S.bodyflags & BALD)) active_character.h_sec_colour = rand_hex_color() if("h_style") - active_character.h_style = random_hair_style(active_character.gender, active_character.species, robohead) + active_character.h_style = random_hair_style(active_character.species, robohead) if("facial") if(!(S.bodyflags & SHAVED)) active_character.f_colour = rand_hex_color() @@ -114,7 +114,7 @@ if(!(S.bodyflags & SHAVED)) active_character.f_sec_colour = rand_hex_color() if("f_style") - active_character.f_style = random_facial_hair_style(active_character.gender, active_character.species, robohead) + active_character.f_style = random_facial_hair_style(active_character.species, robohead) if("headaccessory") if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories. active_character.hacc_colour = rand_hex_color() @@ -206,10 +206,10 @@ var/head_model = "[!active_character.rlimb_data["head"] ? "Morpheus Cyberkinetics" : active_character.rlimb_data["head"]]" robohead = GLOB.all_robolimbs[head_model] //grab one of the valid hair styles for the newly chosen species - active_character.h_style = random_hair_style(active_character.gender, active_character.species, robohead) + active_character.h_style = random_hair_style(active_character.species, robohead) //grab one of the valid facial hair styles for the newly chosen species - active_character.f_style = random_facial_hair_style(active_character.gender, active_character.species, robohead) + active_character.f_style = random_facial_hair_style(active_character.species, robohead) if(NS.bodyflags & HAS_HEAD_ACCESSORY) //Species that have head accessories. active_character.ha_style = random_head_accessory(active_character.species) @@ -319,31 +319,16 @@ active_character.h_sec_colour = new_hair if("h_style") - var/list/valid_hairstyles = list() - for(var/hairstyle in GLOB.hair_styles_public_list) - var/datum/sprite_accessory/SA = GLOB.hair_styles_public_list[hairstyle] + var/datum/robolimb/robohead + if(S.bodyflags & ALL_RPARTS) //Species that can use prosthetic heads. + var/head_model + if(!active_character.rlimb_data["head"]) //Handle situations where the head is default. + head_model = "Morpheus Cyberkinetics" + else + head_model = active_character.rlimb_data["head"] + robohead = GLOB.all_robolimbs[head_model] - if(hairstyle == "Bald") //Just in case. - valid_hairstyles += hairstyle - continue - if(S.bodyflags & ALL_RPARTS) //Species that can use prosthetic heads. - var/head_model - if(!active_character.rlimb_data["head"]) //Handle situations where the head is default. - head_model = "Morpheus Cyberkinetics" - else - head_model = active_character.rlimb_data["head"] - var/datum/robolimb/robohead = GLOB.all_robolimbs[head_model] - if((active_character.species in SA.species_allowed) && robohead.is_monitor && ((SA.models_allowed && (robohead.company in SA.models_allowed)) || !SA.models_allowed)) //If this is a hair style native to the user's species, check to see if they have a head with an ipc-style screen and that the head's company is in the screen style's allowed models list. - valid_hairstyles += hairstyle //Give them their hairstyles if they do. - else - if(!robohead.is_monitor && ("Human" in SA.species_allowed)) /*If the hairstyle is not native to the user's species and they're using a head with an ipc-style screen, don't let them access it. - But if the user has a robotic humanoid head and the hairstyle can fit humans, let them use it as a wig. */ - valid_hairstyles += hairstyle - else //If the user is not a species who can have robotic heads, use the default handling. - if(active_character.species in SA.species_allowed) //If the user's head is of a species the hairstyle allows, add it to the list. - valid_hairstyles += hairstyle - - sortTim(valid_hairstyles, GLOBAL_PROC_REF(cmp_text_asc)) //this alphabetizes the list + var/list/valid_hairstyles = list_valid_hairstyles(active_character.species, robohead) var/new_h_style = tgui_input_list(user, "Choose your character's hair style:", "Character Preference", valid_hairstyles) if(new_h_style) active_character.h_style = new_h_style @@ -389,15 +374,7 @@ if("ha_style") if(S.bodyflags & HAS_HEAD_ACCESSORY) //Species with head accessories. - var/list/valid_head_accessory_styles = list() - for(var/head_accessory_style in GLOB.head_accessory_styles_list) - var/datum/sprite_accessory/H = GLOB.head_accessory_styles_list[head_accessory_style] - if(!(active_character.species in H.species_allowed)) - continue - - valid_head_accessory_styles += head_accessory_style - - sortTim(valid_head_accessory_styles, GLOBAL_PROC_REF(cmp_text_asc)) + var/list/valid_head_accessory_styles = list_valid_head_accessories(active_character.species) var/new_head_accessory_style = tgui_input_list(user, "Choose the style of your character's head accessory", "Character Preference", valid_head_accessory_styles) if(new_head_accessory_style) active_character.ha_style = new_head_accessory_style @@ -425,35 +402,15 @@ if("m_style_head") if(S.bodyflags & HAS_HEAD_MARKINGS) //Species with head markings. - var/list/valid_markings = list() - for(var/markingstyle in GLOB.marking_styles_list) - var/datum/sprite_accessory/body_markings/head/M = GLOB.marking_styles_list[markingstyle] - if(!(active_character.species in M.species_allowed)) - continue - if(M.marking_location != "head") - continue - if(active_character.alt_head && active_character.alt_head != "None") - if(!("All" in M.heads_allowed) && !(active_character.alt_head in M.heads_allowed)) - continue + var/datum/robolimb/robohead + if(S.bodyflags & ALL_RPARTS) //Species that can use prosthetic heads. + var/head_model + if(!active_character.rlimb_data["head"]) //Handle situations where the head is default. + head_model = "Morpheus Cyberkinetics" else - if(M.heads_allowed && !("All" in M.heads_allowed)) - continue - - if(S.bodyflags & ALL_RPARTS) //Species that can use prosthetic heads. - var/head_model - if(!active_character.rlimb_data["head"]) //Handle situations where the head is default. - head_model = "Morpheus Cyberkinetics" - else - head_model = active_character.rlimb_data["head"] - var/datum/robolimb/robohead = GLOB.all_robolimbs[head_model] - if(robohead.is_monitor && M.name != "None") //If the character can have prosthetic heads and they have the default Morpheus head (or another monitor-head), no optic markings. - continue - else if(!robohead.is_monitor && M.name != "None") //Otherwise, if they DON'T have the default head and the head's not a monitor but the head's not in the style's list of allowed models, skip. - if(!(robohead.company in M.models_allowed)) - continue - - valid_markings += markingstyle - sortTim(valid_markings, GLOBAL_PROC_REF(cmp_text_asc)) + head_model = active_character.rlimb_data["head"] + robohead = GLOB.all_robolimbs[head_model] + var/list/valid_markings = list_valid_marking_styles("head", active_character.species, robohead, active_character.body_accessory, active_character.alt_head) if(!length(valid_markings)) // Some IPC head models do have head markings, some don't; This is here to prevent us from attempting to open an empty TGUI list tgui_alert(user, "No head markings available for this head!", "Character Preference") return @@ -470,16 +427,8 @@ if("m_style_body") if(S.bodyflags & HAS_BODY_MARKINGS) //Species with body markings/tattoos. - var/list/valid_markings = list() - for(var/markingstyle in GLOB.marking_styles_list) - var/datum/sprite_accessory/M = GLOB.marking_styles_list[markingstyle] - if(!(active_character.species in M.species_allowed)) - continue - if(M.marking_location != "body") - continue + var/list/valid_markings = list_valid_marking_styles("body", active_character.species, null, active_character.body_accessory, active_character.alt_head) - valid_markings += markingstyle - sortTim(valid_markings, GLOBAL_PROC_REF(cmp_text_asc)) var/new_marking_style = tgui_input_list(user, "Choose the style of your character's body markings:", "Character Preference", valid_markings) if(new_marking_style) active_character.m_styles["body"] = new_marking_style @@ -493,22 +442,8 @@ if("m_style_tail") if(S.bodyflags & HAS_TAIL_MARKINGS) //Species with tail markings. - var/list/valid_markings = list() - for(var/markingstyle in GLOB.marking_styles_list) - var/datum/sprite_accessory/body_markings/tail/M = GLOB.marking_styles_list[markingstyle] - if(M.marking_location != "tail") - continue - if(!(active_character.species in M.species_allowed)) - continue - if(!active_character.body_accessory) - if(M.tails_allowed) - continue - else - if(!M.tails_allowed || !(active_character.body_accessory in M.tails_allowed)) - continue + var/list/valid_markings = list_valid_marking_styles("tail", active_character.species, null, active_character.body_accessory, active_character.alt_head) - valid_markings += markingstyle - sortTim(valid_markings, GLOBAL_PROC_REF(cmp_text_asc)) var/new_marking_style = tgui_input_list(user, "Choose the style of your character's tail markings:", "Character Preference", valid_markings) if(new_marking_style) active_character.m_styles["tail"] = new_marking_style @@ -522,17 +457,12 @@ if("body_accessory") var/list/possible_body_accessories = list() - if(check_rights(R_ADMIN, 1, user)) + if(check_rights(R_ADMIN, FALSE, user)) possible_body_accessories = GLOB.body_accessory_by_name.Copy() else - for(var/B in GLOB.body_accessory_by_name) - var/datum/body_accessory/accessory = GLOB.body_accessory_by_name[B] - if(isnull(accessory)) // None - continue - if(active_character.species in accessory.allowed_species) - possible_body_accessories += B + possible_body_accessories = list_valid_body_accessories(active_character.body_accessory, S.optional_body_accessory) if(S.optional_body_accessory) - possible_body_accessories += "None" //the only null entry should be the "None" option + possible_body_accessories |= "None" //the only null entry should be the "None" option else possible_body_accessories -= "None" // in case an admin is viewing it sortTim(possible_body_accessories, GLOBAL_PROC_REF(cmp_text_asc)) @@ -558,30 +488,16 @@ active_character.f_sec_colour = new_facial if("f_style") - var/list/valid_facial_hairstyles = list() - for(var/facialhairstyle in GLOB.facial_hair_styles_list) - var/datum/sprite_accessory/SA = GLOB.facial_hair_styles_list[facialhairstyle] + var/datum/robolimb/robohead + if(S.bodyflags & ALL_RPARTS) //Species that can use prosthetic heads. + var/head_model + if(!active_character.rlimb_data["head"]) //Handle situations where the head is default. + head_model = "Morpheus Cyberkinetics" + else + head_model = active_character.rlimb_data["head"] + robohead = GLOB.all_robolimbs[head_model] + var/list/valid_facial_hairstyles = list_valid_facial_hairstyles(active_character.species, robohead) - if(facialhairstyle == "Shaved") //Just in case. - valid_facial_hairstyles += facialhairstyle - continue - if(S.bodyflags & ALL_RPARTS) //Species that can use prosthetic heads. - var/head_model - if(!active_character.rlimb_data["head"]) //Handle situations where the head is default. - head_model = "Morpheus Cyberkinetics" - else - head_model = active_character.rlimb_data["head"] - var/datum/robolimb/robohead = GLOB.all_robolimbs[head_model] - if((active_character.species in SA.species_allowed) && robohead.is_monitor && ((SA.models_allowed && (robohead.company in SA.models_allowed)) || !SA.models_allowed)) //If this is a facial hair style native to the user's species, check to see if they have a head with an ipc-style screen and that the head's company is in the screen style's allowed models list. - valid_facial_hairstyles += facialhairstyle //Give them their facial hairstyles if they do. - else - if(!robohead.is_monitor && ("Human" in SA.species_allowed)) /*If the facial hairstyle is not native to the user's species and they're using a head with an ipc-style screen, don't let them access it. - But if the user has a robotic humanoid head and the facial hairstyle can fit humans, let them use it as a wig. */ - valid_facial_hairstyles += facialhairstyle - else //If the user is not a species who can have robotic heads, use the default handling. - if(active_character.species in SA.species_allowed) //If the user's head is of a species the facial hair style allows, add it to the list. - valid_facial_hairstyles += facialhairstyle - sortTim(valid_facial_hairstyles, GLOBAL_PROC_REF(cmp_text_asc)) var/new_f_style = tgui_input_list(user, "Choose your character's facial-hair style", "Character Preference", valid_facial_hairstyles) if(new_f_style) active_character.f_style = new_f_style diff --git a/code/modules/mob/living/carbon/human/appearance.dm b/code/modules/mob/living/carbon/human/appearance.dm index 8c8051b6f5f..5807d7405fa 100644 --- a/code/modules/mob/living/carbon/human/appearance.dm +++ b/code/modules/mob/living/carbon/human/appearance.dm @@ -383,125 +383,46 @@ return sortTim(valid_species, GLOBAL_PROC_REF(cmp_text_asc)) /mob/living/carbon/human/proc/generate_valid_hairstyles() - var/list/valid_hairstyles = list() var/obj/item/organ/external/head/H = get_organ("head") + var/datum/robolimb/robohead if(!H) return //No head, no hair. - - for(var/hairstyle in GLOB.hair_styles_public_list) - var/datum/sprite_accessory/S = GLOB.hair_styles_public_list[hairstyle] - - if(hairstyle == "Bald") //Just in case. - valid_hairstyles += hairstyle - continue - if(H.dna.species.bodyflags & ALL_RPARTS) //If the user is a species who can have a robotic head... - var/datum/robolimb/robohead = GLOB.all_robolimbs[H.model] - if((H.dna.species.name in S.species_allowed) && robohead.is_monitor && ((S.models_allowed && (robohead.company in S.models_allowed)) || !S.models_allowed)) //If this is a hair style native to the user's species, check to see if they have a head with an ipc-style screen and that the head's company is in the screen style's allowed models list. - valid_hairstyles += hairstyle //Give them their hairstyles if they do. - else - if(!robohead.is_monitor && ("Human" in S.species_allowed)) /*If the hairstyle is not native to the user's species and they're using a head with an ipc-style screen, don't let them access it. - But if the user has a robotic humanoid head and the hairstyle can fit humans, let them use it as a wig. */ - valid_hairstyles += hairstyle - else //If the user is not a species who can have robotic heads, use the default handling. - if(H.dna.species.name in S.species_allowed) //If the user's head is of a species the hairstyle allows, add it to the list. - valid_hairstyles += hairstyle - - return sortTim(valid_hairstyles, GLOBAL_PROC_REF(cmp_text_asc)) + if(H.dna.species.bodyflags & ALL_RPARTS) //If the user is a species who can have a robotic head... + robohead = GLOB.all_robolimbs[H.model] + return list_valid_hairstyles(H.dna.species.name, robohead) /mob/living/carbon/human/proc/generate_valid_facial_hairstyles() - var/list/valid_facial_hairstyles = list() var/obj/item/organ/external/head/H = get_organ("head") + var/datum/robolimb/robohead if(!H) return //No head, no hair. - - for(var/facialhairstyle in GLOB.facial_hair_styles_list) - var/datum/sprite_accessory/S = GLOB.facial_hair_styles_list[facialhairstyle] - - if(facialhairstyle == "Shaved") //Just in case. - valid_facial_hairstyles += facialhairstyle - continue - if(H.dna.species.bodyflags & ALL_RPARTS) //If the user is a species who can have a robotic head... - var/datum/robolimb/robohead = GLOB.all_robolimbs[H.model] - if(H.dna.species.name in S.species_allowed) //If this is a facial hair style native to the user's species... - if((H.dna.species.name in S.species_allowed) && robohead.is_monitor && ((S.models_allowed && (robohead.company in S.models_allowed)) || !S.models_allowed)) //If this is a facial hair style native to the user's species, check to see if they have a head with an ipc-style screen and that the head's company is in the screen style's allowed models list. - valid_facial_hairstyles += facialhairstyle - else - if(!robohead.is_monitor && ("Human" in S.species_allowed)) /*If the facial hairstyle is not native to the user's species and they're using a head with an ipc-style screen, don't let them access it. - But if the user has a robotic humanoid head and the facial hairstyle can fit humans, let them use it as a wig. */ - valid_facial_hairstyles += facialhairstyle - else //If the user is not a species who can have robotic heads, use the default handling. - if(H.dna.species.name in S.species_allowed) //If the user's head is of a species the facial hair style allows, add it to the list. - valid_facial_hairstyles += facialhairstyle - - return sortTim(valid_facial_hairstyles, GLOBAL_PROC_REF(cmp_text_asc)) + if(H.dna.species.bodyflags & ALL_RPARTS) //If the user is a species who can have a robotic head... + robohead = GLOB.all_robolimbs[H.model] + return list_valid_facial_hairstyles(H.dna.species.name, robohead) /mob/living/carbon/human/proc/generate_valid_head_accessories() - var/list/valid_head_accessories = list() var/obj/item/organ/external/head/H = get_organ("head") if(!H) return //No head, no head accessory. - for(var/head_accessory in GLOB.head_accessory_styles_list) - var/datum/sprite_accessory/S = GLOB.head_accessory_styles_list[head_accessory] - - if(!(H.dna.species.name in S.species_allowed)) //If the user's head is not of a species the head accessory style allows, skip it. Otherwise, add it to the list. - continue - valid_head_accessories += head_accessory - - return sortTim(valid_head_accessories, GLOBAL_PROC_REF(cmp_text_asc)) + return list_valid_head_accessories(H.dna.species.name) /mob/living/carbon/human/proc/generate_valid_markings(location = "body") - var/list/valid_markings = list() var/obj/item/organ/external/head/H = get_organ("head") + var/datum/robolimb/robohead if(!H && location == "head") return //No head, no head markings. + if(H.dna.species.bodyflags & ALL_RPARTS) //If the user is a species who can have a robotic head... + robohead = GLOB.all_robolimbs[H.model] - for(var/marking in GLOB.marking_styles_list) - var/datum/sprite_accessory/body_markings/S = GLOB.marking_styles_list[marking] - if(S.name == "None") - valid_markings += marking - continue - if(S.marking_location != location) //If the marking isn't for the location we desire, skip. - continue - if(!(dna.species.name in S.species_allowed)) //If the user is not of a species the marking style allows, skip it. Otherwise, add it to the list. - continue - if(location == "tail") - if(!body_accessory) - if(S.tails_allowed) - continue - else - if(!S.tails_allowed || !(body_accessory.name in S.tails_allowed)) - continue - if(location == "head") - var/datum/sprite_accessory/body_markings/head/M = GLOB.marking_styles_list[S.name] - if(H.dna.species.bodyflags & ALL_RPARTS) //If the user is a species that can have a robotic head... - var/datum/robolimb/robohead = GLOB.all_robolimbs[H.model] - if(!(S.models_allowed && (robohead.company in S.models_allowed))) //Make sure they don't get markings incompatible with their head. - continue - else if(H.alt_head && H.alt_head != "None") //If the user's got an alt head, validate markings for that head. - if(!M.heads_allowed || (!("All" in M.heads_allowed) && !(H.alt_head in M.heads_allowed))) - continue - else - if(M.heads_allowed && !("All" in M.heads_allowed)) - continue - valid_markings += marking - - return sortTim(valid_markings, GLOBAL_PROC_REF(cmp_text_asc)) + return list_valid_marking_styles(location, H.dna.species.name, robohead, body_accessory, H.alt_head) /mob/living/carbon/human/proc/generate_valid_body_accessories() - var/list/valid_body_accessories = list() - for(var/B in GLOB.body_accessory_by_name) - var/datum/body_accessory/A = GLOB.body_accessory_by_name[B] - if(isnull(A)) - continue - else if(check_rights(R_ADMIN, FALSE, src)) - valid_body_accessories = GLOB.body_accessory_by_name.Copy() - break - else if(dna.species.name in A.allowed_species) //If the user is not of a species the body accessory style allows, skip it. Otherwise, add it to the list. - valid_body_accessories += B + if(check_rights(R_ADMIN, FALSE, src)) + return GLOB.body_accessory_by_name.Copy() + var/list/valid_body_accessories = list_valid_body_accessories(dna.species.name, FALSE) if(dna.species.optional_body_accessory) valid_body_accessories += "None" - return sortTim(valid_body_accessories, GLOBAL_PROC_REF(cmp_text_asc)) /mob/living/carbon/human/proc/generate_valid_alt_heads() diff --git a/code/modules/reagents/chemistry/reagents/misc_reagents.dm b/code/modules/reagents/chemistry/reagents/misc_reagents.dm index 27adb69c25b..cabdab0ea23 100644 --- a/code/modules/reagents/chemistry/reagents/misc_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/misc_reagents.dm @@ -352,8 +352,8 @@ var/obj/item/organ/external/head/head_organ = H.get_organ("head") if(!istype(head_organ)) return ..() - head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.name) - head_organ.f_style = random_facial_hair_style(H.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) + head_organ.f_style = random_facial_hair_style(head_organ.dna.species.name) H.update_hair() H.update_fhair() ..() @@ -379,11 +379,11 @@ if(head_organ.dna.species.name in tmp_hair_style.species_allowed) //If 'Very Long Hair' is a style the person's species can have, give it to them. head_organ.h_style = "Very Long Hair" else //Otherwise, give them a random hair style. - head_organ.h_style = random_hair_style(H.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) if(head_organ.dna.species.name in tmp_facial_hair_style.species_allowed) //If 'Very Long Beard' is a style the person's species can have, give it to them. head_organ.f_style = "Very Long Beard" else //Otherwise, give them a random facial hair style. - head_organ.f_style = random_facial_hair_style(H.gender, head_organ.dna.species.name) + head_organ.f_style = random_facial_hair_style(head_organ.dna.species.name) H.update_hair() H.update_fhair() if(!H.wear_mask || H.wear_mask && !istype(H.wear_mask, /obj/item/clothing/mask/fakemoustache)) diff --git a/code/modules/response_team/ert.dm b/code/modules/response_team/ert.dm index 789568c97f3..ad64763ad55 100644 --- a/code/modules/response_team/ert.dm +++ b/code/modules/response_team/ert.dm @@ -177,9 +177,9 @@ GLOBAL_LIST_EMPTY(ert_request_messages) M.change_eye_color(eye_c, FALSE) M.change_skin_tone(random_skin_tone(M.dna.species.name)) head_organ.headacc_colour = pick("#1f138b", "#272525", "#07a035", "#8c00ff", "#a80c0c") - head_organ.h_style = random_hair_style(M.gender, head_organ.dna.species.name) + head_organ.h_style = random_hair_style(head_organ.dna.species.name) if(M.gender != FEMALE) // no beard for women pls - head_organ.f_style = random_facial_hair_style(M.gender, head_organ.dna.species.name) + head_organ.f_style = random_facial_hair_style(head_organ.dna.species.name) M.rename_character(M.real_name, "[pick("Corporal", "Sergeant", "Staff Sergeant", "Sergeant First Class", "Master Sergeant", "Sergeant Major")] [pick(GLOB.last_names)]") M.age = rand(23,35)