diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 1f6c2101e3..c84d74d305 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -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), } diff --git a/common/src/comp/body/biped_large.rs b/common/src/comp/body/biped_large.rs new file mode 100644 index 0000000000..41eab2caf7 --- /dev/null +++ b/common/src/comp/body/biped_large.rs @@ -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]; \ No newline at end of file diff --git a/common/src/comp/body/bird_small.rs b/common/src/comp/body/bird_small.rs new file mode 100644 index 0000000000..eff28e3119 --- /dev/null +++ b/common/src/comp/body/bird_small.rs @@ -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]; diff --git a/common/src/comp/body/fish_small.rs b/common/src/comp/body/fish_small.rs new file mode 100644 index 0000000000..0b5ba39ea7 --- /dev/null +++ b/common/src/comp/body/fish_small.rs @@ -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]; \ No newline at end of file diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index eae3a2aa9b..572d5eb0e6 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -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,