body tweak

This commit is contained in:
jshipsey 2019-10-24 19:42:33 -04:00
parent 574f070758
commit 25448ae2a1
5 changed files with 181 additions and 1 deletions

View File

@ -5,6 +5,9 @@ pub mod quadruped_medium;
pub mod bird_medium;
pub mod fish_medium;
pub mod dragon;
pub mod bird_small;
pub mod fish_small;
pub mod biped_large;
use specs::{Component, FlaggedStorage};
use specs_idvs::IDVStorage;
@ -17,6 +20,9 @@ pub enum Body {
BirdMedium(bird_medium::Body),
FishMedium(fish_medium::Body),
Dragon(dragon::Body),
BirdSmall(bird_small::Body),
FishSmall(fish_small::Body),
BipedLarge(biped_large::Body),
Object(object::Body),
}

View File

@ -0,0 +1,100 @@
use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Body {
pub head: Head,
pub upper_torso: UpperTorso,
pub lower_torso: LowerTorso,
pub shoulder_l: ShoulderL,
pub shoulder_r: ShoulderR,
pub hand_l: HandL,
pub hand_r: HandR,
pub leg_l: LegL,
pub leg_r: LegR,
pub foot_l: FootL,
pub foot_r: FootR,
}
impl Body {
pub fn random() -> Self {
let mut rng = thread_rng();
Self {
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
upper_torso: *(&ALL_UPPER_TORSOS).choose(&mut rng).unwrap(),
lower_torso: *(&ALL_LOWER_TORSOS).choose(&mut rng).unwrap(),
shoulder_l: *(&ALL_SHOULDER_LS).choose(&mut rng).unwrap(),
shoulder_r: *(&ALL_SHOULDER_RS).choose(&mut rng).unwrap(),
hand_l: *(&ALL_HAND_LS).choose(&mut rng).unwrap(),
hand_r: *(&ALL_HAND_RS).choose(&mut rng).unwrap(),
leg_l: *(&ALL_LEG_LS).choose(&mut rng).unwrap(),
leg_r: *(&ALL_LEG_RS).choose(&mut rng).unwrap(),
foot_l: *(&ALL_FOOT_LS).choose(&mut rng).unwrap(),
foot_r: *(&ALL_FOOT_RS).choose(&mut rng).unwrap(),
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Head {
Default,
}
const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum UpperTorso {
Default,
}
const ALL_UPPER_TORSOS: [UpperTorso; 1] = [UpperTorso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LowerTorso {
Default,
}
const ALL_LOWER_TORSOS: [LowerTorso; 1] = [LowerTorso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ShoulderL {
Default,
}
const ALL_SHOULDER_LS: [ShoulderL; 1] = [ShoulderL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ShoulderR {
Default,
}
const ALL_SHOULDER_RS: [ShoulderR; 1] = [ShoulderR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum HandL {
Default,
}
const ALL_HAND_LS: [HandL; 1] = [HandL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum HandR {
Default,
}
const ALL_HAND_RS: [HandR; 1] = [HandR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LegL {
Default,
}
const ALL_LEG_LS: [LegL; 1] = [LegL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LegR {
Default,
}
const ALL_LEG_RS: [LegR; 1] = [LegR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum FootL {
Default,
}
const ALL_FOOT_LS: [FootL; 1] = [FootL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum FootR {
Default,
}
const ALL_FOOT_RS: [FootR; 1] = [FootR::Default];

View File

@ -0,0 +1,45 @@
use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Body {
pub head: Head,
pub torso: Torso,
pub wing_l: WingL,
pub wing_r: WingR,
}
impl Body {
pub fn random() -> Self {
let mut rng = thread_rng();
Self {
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
wing_l: *(&ALL_WING_LS).choose(&mut rng).unwrap(),
wing_r: *(&ALL_WING_RS).choose(&mut rng).unwrap(),
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Head {
Default,
}
const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Torso {
Default,
}
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WingL {
Default,
}
const ALL_WING_LS: [WingL; 1] = [WingL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WingR {
Default,
}
const ALL_WING_RS: [WingR; 1] = [WingR::Default];

View File

@ -0,0 +1,29 @@
use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Body {
pub torso: Torso,
pub tail: Tail,
}
impl Body {
pub fn random() -> Self {
let mut rng = thread_rng();
Self {
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
tail: *(&ALL_TAILS).choose(&mut rng).unwrap(),
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Torso {
Default,
}
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Tail {
Default,
}
const ALL_TAILS: [Tail; 1] = [Tail::Default];

View File

@ -16,7 +16,7 @@ mod visual;
// Reexports
pub use admin::Admin;
pub use agent::Agent;
pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, Body};
pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Body};
pub use character_state::{ActionState, CharacterState, MovementState};
pub use controller::{
ControlEvent, Controller, ControllerInputs, InventoryManip, MountState, Mounting,