Remove randomization of species and body_type with the randomize button in char creation

This commit is contained in:
Imbris 2020-11-13 19:43:32 -05:00
parent 1ed90bd0bf
commit 1952785af2
2 changed files with 14 additions and 4 deletions

View File

@ -42,9 +42,9 @@ impl Body {
hair_style: rng.gen_range(0, species.num_hair_styles(body_type)),
beard: rng.gen_range(0, species.num_beards(body_type)),
accessory: rng.gen_range(0, species.num_accessories(body_type)),
hair_color: rng.gen_range(0, species.num_hair_colors()) as u8,
skin: rng.gen_range(0, species.num_skin_colors()) as u8,
eye_color: rng.gen_range(0, species.num_eye_colors()) as u8,
hair_color: rng.gen_range(0, species.num_hair_colors()),
skin: rng.gen_range(0, species.num_skin_colors()),
eye_color: rng.gen_range(0, species.num_eye_colors()),
eyes: rng.gen_range(0, 1), /* TODO Add a way to set specific head-segments for NPCs
* with the default being a random one */
}

View File

@ -1257,7 +1257,17 @@ impl Controls {
Message::RandomizeCharacter => {
if let Mode::Create { name, body, .. } = &mut self.mode {
use common::npc;
*body = comp::humanoid::Body::random();
use rand::Rng;
let body_type = body.body_type;
let species = body.species;
let mut rng = rand::thread_rng();
body.hair_style = rng.gen_range(0, species.num_hair_styles(body_type));
body.beard = rng.gen_range(0, species.num_beards(body_type));
body.accessory = rng.gen_range(0, species.num_accessories(body_type));
body.hair_color = rng.gen_range(0, species.num_hair_colors());
body.skin = rng.gen_range(0, species.num_skin_colors());
body.eye_color = rng.gen_range(0, species.num_eye_colors());
body.eyes = rng.gen_range(0, species.num_eyes(body_type));
*name = npc::get_npc_name(npc::NpcKind::Humanoid).to_string();
}
},