De-hardcodes randomize_human() and fixes some related issues along the way (#68876)

* First draft on this branch. Should work.

* Whoopsie

* Some fixes

* And again

* Final draft, question mark?

* Please enter the commit message for your changes

* Uhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh

* please work

* Saving for the week offline

* Final draft

* Final final draft

* Oh and clean this up

* eah

* Okay, final for real.

* I lied.

* Sure thing boss

* clinclin

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>

* That's all of em I think

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
FernandoJ8
2022-08-15 04:55:13 +02:00
committed by GitHub
parent 8b39073437
commit aa2eee2ded
16 changed files with 55 additions and 45 deletions
+1 -1
View File
@@ -423,7 +423,7 @@
monkey_tail.Insert(human_mob, drop_if_replaced = FALSE)
var/datum/species/human_species = human_mob.dna?.species
if(human_species)
human_species.randomize_main_appearance_element(human_mob)
human_species.randomize_features(human_mob)
human_species.randomize_active_underwear(human_mob)
owner.remove_status_effect(/datum/status_effect/eigenstasium)
+12 -18
View File
@@ -11,13 +11,13 @@
user << browse(create_panel_helper(create_mob_html), "window=create_mob;size=425x475")
/proc/randomize_human(mob/living/carbon/human/human)
human.gender = pick(MALE, FEMALE)
if(human.dna.species.sexes)
human.gender = pick(MALE, FEMALE, PLURAL)
else
human.gender = PLURAL
human.physique = human.gender
human.real_name = human.dna?.species.random_name(human.gender) || random_unique_name(human.gender)
human.name = human.real_name
human.underwear = random_underwear(human.gender)
human.underwear_color = "#[random_color()]"
human.skin_tone = random_skin_tone()
human.hairstyle = random_hairstyle(human.gender)
human.facial_hairstyle = random_facial_hairstyle(human.gender)
human.hair_color = "#[random_color()]"
@@ -25,21 +25,15 @@
var/random_eye_color = random_eye_color()
human.eye_color_left = random_eye_color
human.eye_color_right = random_eye_color
human.dna.blood_type = random_blood_type()
// Mutant randomizing, doesn't affect the mob appearance unless it's the specific mutant.
human.dna.features["mcolor"] = "#[random_color()]"
human.dna.features["ethcolor"] = GLOB.color_list_ethereal[pick(GLOB.color_list_ethereal)]
human.dna.features["tail_cat"] = pick(GLOB.tails_list_human)
human.dna.features["tail_lizard"] = pick(GLOB.tails_list_lizard)
human.dna.features["snout"] = pick(GLOB.snouts_list)
human.dna.features["horns"] = pick(GLOB.horns_list)
human.dna.features["frills"] = pick(GLOB.frills_list)
human.dna.features["spines"] = pick(GLOB.spines_list)
human.dna.features["body_markings"] = pick(GLOB.body_markings_list)
human.dna.features["moth_wings"] = pick(GLOB.moth_wings_list)
human.dna.features["moth_antennae"] = pick(GLOB.moth_antennae_list)
human.dna.features["pod_hair"] = pick(GLOB.pod_hair_list)
human.dna.species.randomize_active_underwear(human)
human.update_body(is_creating = TRUE)
for(var/datum/species/species_path as anything in subtypesof(/datum/species))
var/datum/species/new_species = new species_path
new_species.randomize_features(human)
human.dna.species.spec_updatehealth(human)
human.dna.update_dna_identity()
human.updateappearance()
human.update_body(is_creating = TRUE)
@@ -13,4 +13,3 @@
randomize_human(owner)
var/species = pick(list(/datum/species/human, /datum/species/lizard, /datum/species/moth, /datum/species/fly))
owner.set_species(species)
owner.dna.update_dna_identity()
@@ -28,7 +28,6 @@
return
var/mob/living/carbon/human/human_knight = .
randomize_human(human_knight)
human_knight.dna.update_dna_identity()
human_knight.dna.add_mutation(/datum/mutation/human/medieval, MUT_OTHER)
var/oldname = human_knight.name
var/title = "error"
@@ -40,7 +40,6 @@
all_species += stype
var/random_race = pick(all_species)
H.set_species(random_race)
H.dna.update_dna_identity()
L = H
var/turf/T = find_safe_turf(extended_safety_checks = TRUE, dense_atoms = FALSE)
L.forceMove(T)
@@ -786,10 +786,6 @@ GLOBAL_LIST_EMPTY(features_by_species)
if(BODY_FRONT_LAYER)
return "FRONT"
///Proc that will randomise the hair, or primary appearance element (i.e. for moths wings) of a species' associated mob
/datum/species/proc/randomize_main_appearance_element(mob/living/carbon/human/human_mob)
human_mob.hairstyle = random_hairstyle(human_mob.gender)
human_mob.update_hair(is_creating = TRUE)
///Proc that will randomise the underwear (i.e. top, pants and socks) of a species' associated mob
/datum/species/proc/randomize_active_underwear(mob/living/carbon/human/human_mob)
@@ -798,6 +794,19 @@ GLOBAL_LIST_EMPTY(features_by_species)
human_mob.socks = random_socks(human_mob.gender)
human_mob.update_body()
///Proc that will randomize all the external organs (i.e. horns, frills, tails etc.) of a species' associated mob
/datum/species/proc/randomize_external_organs(mob/living/carbon/human/human_mob)
for(var/obj/item/organ/external/organ_path as anything in external_organs)
var/obj/item/organ/external/randomized_organ = human_mob.getorgan(organ_path)
if(randomized_organ)
var/new_look = pick(randomized_organ.get_global_feature_list())
human_mob.dna.features["[randomized_organ.feature_key]"] = new_look
mutant_bodyparts["[randomized_organ.feature_key]"] = new_look
///Proc that randomizes all the appearance elements (external organs, markings, hair etc.) of a species' associated mob. Function set by child procs
/datum/species/proc/randomize_features(mob/living/carbon/human/human_mob)
return
/datum/species/proc/spec_life(mob/living/carbon/human/H, delta_time, times_fired)
if(HAS_TRAIT(H, TRAIT_NOBREATH))
H.setOxyLoss(0)
@@ -99,6 +99,8 @@
return randname
/datum/species/ethereal/randomize_features(mob/living/carbon/human/human_mob)
human_mob.dna.features["ethcolor"] = GLOB.color_list_ethereal[pick(GLOB.color_list_ethereal)]
/datum/species/ethereal/spec_updatehealth(mob/living/carbon/human/ethereal)
. = ..()
@@ -42,6 +42,10 @@
mutantears = /obj/item/organ/internal/ears
return ..()
/datum/species/human/felinid/randomize_features(mob/living/carbon/human/human_mob)
randomize_external_organs(human_mob)
return ..()
/proc/mass_purrbation()
for(var/mob in GLOB.human_list)
purrbation_apply(mob)
@@ -21,6 +21,9 @@
human.hair_color = "#bb9966" // brown
human.update_hair(is_creating = TRUE)
/datum/species/human/randomize_features(mob/living/carbon/human/human_mob)
human_mob.skin_tone = random_skin_tone()
/datum/species/human/get_scream_sound(mob/living/carbon/human/human)
if(human.gender == MALE)
if(prob(1))
@@ -71,11 +71,10 @@
return randname
/datum/species/lizard/randomize_main_appearance_element(mob/living/carbon/human/human_mob)
var/tail = pick(GLOB.tails_list_lizard)
human_mob.dna.features["tail_lizard"] = tail
mutant_bodyparts["tail_lizard"] = tail
human_mob.update_body()
/datum/species/lizard/randomize_features(mob/living/carbon/human/human_mob)
human_mob.dna.features["body_markings"] = pick(GLOB.body_markings_list)
randomize_external_organs(human_mob)
/datum/species/lizard/get_scream_sound(mob/living/carbon/human/lizard)
return pick(
@@ -66,13 +66,10 @@
return 10 //flyswatters deal 10x damage to moths
return 1
/datum/species/moth/randomize_main_appearance_element(mob/living/carbon/human/human_mob)
var/wings = pick(GLOB.moth_wings_list)
mutant_bodyparts["wings"] = wings
mutant_bodyparts["moth_wings"] = wings
human_mob.dna.features["wings"] = wings
human_mob.dna.features["moth_wings"] = wings
human_mob.update_body()
/datum/species/moth/randomize_features(mob/living/carbon/human/human_mob)
human_mob.dna.features["moth_markings"] = pick(GLOB.moth_markings_list)
randomize_external_organs(human_mob)
/datum/species/moth/get_scream_sound(mob/living/carbon/human/human)
return 'sound/voice/moth/scream_moth.ogg'
@@ -67,11 +67,9 @@
H.reagents.remove_reagent(chem.type, REAGENTS_METABOLISM * delta_time)
return TRUE
/datum/species/pod/randomize_main_appearance_element(mob/living/carbon/human/human_mob)
var/hairstyle = pick(GLOB.pod_hair_list)
human_mob.dna.features["pod_hair"] = hairstyle
mutant_bodyparts["pod_hair"] = hairstyle
human_mob.update_body()
/datum/species/pod/randomize_features(mob/living/carbon/human_mob)
randomize_external_organs(human_mob)
/datum/species/pod/proc/change_hairstyle(mob/living/carbon/human/human_mob, new_style)
var/obj/item/organ/external/organ = human_mob.getorganslot(ORGAN_SLOT_EXTERNAL_POD_HAIR)
@@ -742,7 +742,6 @@
to_chat(H, span_warning("<b>You grit your teeth in pain as your body rapidly mutates!</b>"))
H.visible_message("<b>[H]</b> suddenly transforms!")
randomize_human(H)
H.dna.update_dna_identity()
/datum/reagent/aslimetoxin
name = "Advanced Mutation Toxin"
@@ -810,7 +810,6 @@
originalname = H.real_name
H.dna.copy_dna(originalDNA)
randomize_human(H)
H.dna.update_dna_identity()
return ..()
// Only occasionally give examiners a warning.
@@ -381,6 +381,9 @@
color_source = ORGAN_COLOR_OVERRIDE
/obj/item/organ/external/pod_hair/get_global_feature_list()
return GLOB.pod_hair_list
/obj/item/organ/external/pod_hair/can_draw_on_bodypart(mob/living/carbon/human/human)
if(!(human.head?.flags_inv & HIDEHAIR) || (human.wear_mask?.flags_inv & HIDEHAIR))
return TRUE
+6
View File
@@ -77,6 +77,9 @@
color_source = ORGAN_COLOR_HAIR
wag_flags = WAG_ABLE
/obj/item/organ/external/tail/cat/get_global_feature_list()
return GLOB.tails_list_human
/obj/item/organ/external/tail/monkey
color_source = NONE
@@ -89,6 +92,9 @@
///A reference to the paired_spines, since for some fucking reason tail spines are tied to the spines themselves.
var/obj/item/organ/external/spines/paired_spines
/obj/item/organ/external/tail/lizard/get_global_feature_list()
return GLOB.tails_list_lizard
/obj/item/organ/external/tail/lizard/Insert(mob/living/carbon/reciever, special, drop_if_replaced)
. = ..()
if(.)