Enumerated Body type

This commit is contained in:
Joshua Barretto 2020-01-20 14:21:06 +00:00
parent 0757083b19
commit 8f86e45a72
13 changed files with 217 additions and 131 deletions

View File

@ -13,17 +13,18 @@ use specs::{Component, FlaggedStorage};
use specs_idvs::IDVStorage; use specs_idvs::IDVStorage;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Body { pub enum Body {
Humanoid(humanoid::Body), Humanoid(humanoid::Body) = 0,
QuadrupedSmall(quadruped_small::Body), QuadrupedSmall(quadruped_small::Body) = 1,
QuadrupedMedium(quadruped_medium::Body), QuadrupedMedium(quadruped_medium::Body) = 2,
BirdMedium(bird_medium::Body), BirdMedium(bird_medium::Body) = 3,
FishMedium(fish_medium::Body), FishMedium(fish_medium::Body) = 4,
Dragon(dragon::Body), Dragon(dragon::Body) = 5,
BirdSmall(bird_small::Body), BirdSmall(bird_small::Body) = 6,
FishSmall(fish_small::Body), FishSmall(fish_small::Body) = 7,
BipedLarge(biped_large::Body), BipedLarge(biped_large::Body) = 8,
Object(object::Body), Object(object::Body) = 9,
} }
impl Body { impl Body {

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head: Head, pub head: Head,
pub upper_torso: UpperTorso, pub upper_torso: UpperTorso,
@ -34,66 +35,77 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head { pub enum Head {
Default, Default,
} }
const ALL_HEADS: [Head; 1] = [Head::Default]; const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum UpperTorso { pub enum UpperTorso {
Default, Default,
} }
const ALL_UPPER_TORSOS: [UpperTorso; 1] = [UpperTorso::Default]; const ALL_UPPER_TORSOS: [UpperTorso; 1] = [UpperTorso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum LowerTorso { pub enum LowerTorso {
Default, Default,
} }
const ALL_LOWER_TORSOS: [LowerTorso; 1] = [LowerTorso::Default]; const ALL_LOWER_TORSOS: [LowerTorso; 1] = [LowerTorso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum ShoulderL { pub enum ShoulderL {
Default, Default,
} }
const ALL_SHOULDER_LS: [ShoulderL; 1] = [ShoulderL::Default]; const ALL_SHOULDER_LS: [ShoulderL; 1] = [ShoulderL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum ShoulderR { pub enum ShoulderR {
Default, Default,
} }
const ALL_SHOULDER_RS: [ShoulderR; 1] = [ShoulderR::Default]; const ALL_SHOULDER_RS: [ShoulderR; 1] = [ShoulderR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum HandL { pub enum HandL {
Default, Default,
} }
const ALL_HAND_LS: [HandL; 1] = [HandL::Default]; const ALL_HAND_LS: [HandL; 1] = [HandL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum HandR { pub enum HandR {
Default, Default,
} }
const ALL_HAND_RS: [HandR; 1] = [HandR::Default]; const ALL_HAND_RS: [HandR; 1] = [HandR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum LegL { pub enum LegL {
Default, Default,
} }
const ALL_LEG_LS: [LegL; 1] = [LegL::Default]; const ALL_LEG_LS: [LegL; 1] = [LegL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum LegR { pub enum LegR {
Default, Default,
} }
const ALL_LEG_RS: [LegR; 1] = [LegR::Default]; const ALL_LEG_RS: [LegR; 1] = [LegR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootL { pub enum FootL {
Default, Default,
} }
const ALL_FOOT_LS: [FootL; 1] = [FootL::Default]; const ALL_FOOT_LS: [FootL; 1] = [FootL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootR { pub enum FootR {
Default, Default,
} }

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head: Head, pub head: Head,
pub torso: Torso, pub torso: Torso,
@ -26,42 +27,49 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head { pub enum Head {
Default, Default,
} }
const ALL_HEADS: [Head; 1] = [Head::Default]; const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Torso { pub enum Torso {
Default, Default,
} }
const ALL_TORSOS: [Torso; 1] = [Torso::Default]; const ALL_TORSOS: [Torso; 1] = [Torso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Tail { pub enum Tail {
Default, Default,
} }
const ALL_TAILS: [Tail; 1] = [Tail::Default]; const ALL_TAILS: [Tail; 1] = [Tail::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingL { pub enum WingL {
Default, Default,
} }
const ALL_WING_LS: [WingL; 1] = [WingL::Default]; const ALL_WING_LS: [WingL; 1] = [WingL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingR { pub enum WingR {
Default, Default,
} }
const ALL_WING_RS: [WingR; 1] = [WingR::Default]; const ALL_WING_RS: [WingR; 1] = [WingR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum LegL { pub enum LegL {
Default, Default,
} }
const ALL_LEG_LS: [LegL; 1] = [LegL::Default]; const ALL_LEG_LS: [LegL; 1] = [LegL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum LegR { pub enum LegR {
Default, Default,
} }

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head: Head, pub head: Head,
pub torso: Torso, pub torso: Torso,
@ -20,24 +21,28 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head { pub enum Head {
Default, Default,
} }
const ALL_HEADS: [Head; 1] = [Head::Default]; const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Torso { pub enum Torso {
Default, Default,
} }
const ALL_TORSOS: [Torso; 1] = [Torso::Default]; const ALL_TORSOS: [Torso; 1] = [Torso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingL { pub enum WingL {
Default, Default,
} }
const ALL_WING_LS: [WingL; 1] = [WingL::Default]; const ALL_WING_LS: [WingL; 1] = [WingL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingR { pub enum WingR {
Default, Default,
} }

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head: Head, pub head: Head,
pub chest_front: ChestFront, pub chest_front: ChestFront,
@ -38,78 +39,91 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head { pub enum Head {
Default, Default,
} }
const ALL_HEADS: [Head; 1] = [Head::Default]; const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum ChestFront { pub enum ChestFront {
Default, Default,
} }
const ALL_CHEST_FRONTS: [ChestFront; 1] = [ChestFront::Default]; const ALL_CHEST_FRONTS: [ChestFront; 1] = [ChestFront::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum ChestRear { pub enum ChestRear {
Default, Default,
} }
const ALL_CHEST_REARS: [ChestRear; 1] = [ChestRear::Default]; const ALL_CHEST_REARS: [ChestRear; 1] = [ChestRear::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum TailFront { pub enum TailFront {
Default, Default,
} }
const ALL_TAIL_FRONTS: [TailFront; 1] = [TailFront::Default]; const ALL_TAIL_FRONTS: [TailFront; 1] = [TailFront::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum TailRear { pub enum TailRear {
Default, Default,
} }
const ALL_TAIL_REARS: [TailRear; 1] = [TailRear::Default]; const ALL_TAIL_REARS: [TailRear; 1] = [TailRear::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingInL { pub enum WingInL {
Default, Default,
} }
const ALL_WING_IN_LS: [WingInL; 1] = [WingInL::Default]; const ALL_WING_IN_LS: [WingInL; 1] = [WingInL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingInR { pub enum WingInR {
Default, Default,
} }
const ALL_WING_IN_RS: [WingInR; 1] = [WingInR::Default]; const ALL_WING_IN_RS: [WingInR; 1] = [WingInR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingOutL { pub enum WingOutL {
Default, Default,
} }
const ALL_WING_OUT_LS: [WingOutL; 1] = [WingOutL::Default]; const ALL_WING_OUT_LS: [WingOutL; 1] = [WingOutL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingOutR { pub enum WingOutR {
Default, Default,
} }
const ALL_WING_OUT_RS: [WingOutR; 1] = [WingOutR::Default]; const ALL_WING_OUT_RS: [WingOutR; 1] = [WingOutR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootFL { pub enum FootFL {
Default, Default,
} }
const ALL_FOOT_FLS: [FootFL; 1] = [FootFL::Default]; const ALL_FOOT_FLS: [FootFL; 1] = [FootFL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootFR { pub enum FootFR {
Default, Default,
} }
const ALL_FOOT_FRS: [FootFR; 1] = [FootFR::Default]; const ALL_FOOT_FRS: [FootFR; 1] = [FootFR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootBL { pub enum FootBL {
Default, Default,
} }
const ALL_FOOT_BLS: [FootBL; 1] = [FootBL::Default]; const ALL_FOOT_BLS: [FootBL; 1] = [FootBL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootBR { pub enum FootBR {
Default, Default,
} }

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head: Head, pub head: Head,
pub torso: Torso, pub torso: Torso,
@ -24,36 +25,42 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head { pub enum Head {
Default, Default,
} }
const ALL_HEADS: [Head; 1] = [Head::Default]; const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Torso { pub enum Torso {
Default, Default,
} }
const ALL_TORSOS: [Torso; 1] = [Torso::Default]; const ALL_TORSOS: [Torso; 1] = [Torso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Rear { pub enum Rear {
Default, Default,
} }
const ALL_REARS: [Rear; 1] = [Rear::Default]; const ALL_REARS: [Rear; 1] = [Rear::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Tail { pub enum Tail {
Default, Default,
} }
const ALL_TAILS: [Tail; 1] = [Tail::Default]; const ALL_TAILS: [Tail; 1] = [Tail::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FinL { pub enum FinL {
Default, Default,
} }
const ALL_FIN_LS: [FinL; 1] = [FinL::Default]; const ALL_FIN_LS: [FinL; 1] = [FinL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FinR { pub enum FinR {
Default, Default,
} }

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub torso: Torso, pub torso: Torso,
pub tail: Tail, pub tail: Tail,
@ -16,12 +17,14 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Torso { pub enum Torso {
Default, Default,
} }
const ALL_TORSOS: [Torso; 1] = [Torso::Default]; const ALL_TORSOS: [Torso; 1] = [Torso::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Tail { pub enum Tail {
Default, Default,
} }

View File

@ -1,14 +1,15 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head: Head, pub head: Head,
pub shoulder: Shoulder, pub shoulder: Shoulder,
pub chest: Chest, pub chest: Chest,
pub hand: Hand pub hand: Hand
pub belt: Belt, pub belt: Belt,
pub pants: Pants, pub pants: Pants,
pub foot: Foot, pub foot: Foot,
} }
impl Body { impl Body {
@ -27,40 +28,47 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head { pub enum Head {
Default, Default,
} }
const ALL_HEADS: [Head; 1] = [Head::Default]; const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Shoulder { pub enum Shoulder {
Default, Default,
} }
const ALL_SHOULDERS: [Shoulder; 1] = [Shoulder::Default]; const ALL_SHOULDERS: [Shoulder; 1] = [Shoulder::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Chest { pub enum Chest {
Default, Default,
} }
const ALL_CHESTS: [Chest; 1] = [Chest::Default]; const ALL_CHESTS: [Chest; 1] = [Chest::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Hand { pub enum Hand {
Default, Default,
} }
const ALL_HANDS: [Hand; 1] = [Hand::Default]; const ALL_HANDS: [Hand; 1] = [Hand::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Belt { pub enum Belt {
Default, Default,
} }
const ALL_BELTS: [Belt; 1] = [Belt::Default]; const ALL_BELTS: [Belt; 1] = [Belt::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Pants { pub enum Pants {
Default, Default,
} }
const ALL_FEET: [Foot; 1] = [Foot::Default]; const ALL_FEET: [Foot; 1] = [Foot::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Foot { pub enum Foot {
Default, Default,
} }

View File

@ -2,6 +2,7 @@ use rand::{seq::SliceRandom, thread_rng, Rng};
use vek::Rgb; use vek::Rgb;
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub race: Race, pub race: Race,
pub body_type: BodyType, pub body_type: BodyType,
@ -59,13 +60,14 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Race { pub enum Race {
Danari, Danari = 0,
Dwarf, Dwarf = 1,
Elf, Elf = 2,
Human, Human = 3,
Orc, Orc = 4,
Undead, Undead = 5,
} }
pub const ALL_RACES: [Race; 6] = [ pub const ALL_RACES: [Race; 6] = [
Race::Danari, Race::Danari,
@ -379,21 +381,23 @@ impl Race {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum BodyType { pub enum BodyType {
Female, Female = 0,
Male, Male = 1,
} }
pub const ALL_BODY_TYPES: [BodyType; 2] = [BodyType::Female, BodyType::Male]; pub const ALL_BODY_TYPES: [BodyType; 2] = [BodyType::Female, BodyType::Male];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Chest { pub enum Chest {
Blue, Blue = 0,
Brown, Brown = 1,
Dark, Dark = 2,
Green, Green = 3,
Orange, Orange = 4,
Midnight, Midnight = 5,
Kimono, Kimono = 6,
} }
pub const ALL_CHESTS: [Chest; 7] = [ pub const ALL_CHESTS: [Chest; 7] = [
Chest::Blue, Chest::Blue,
@ -406,20 +410,22 @@ pub const ALL_CHESTS: [Chest; 7] = [
]; ];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Belt { pub enum Belt {
Dark, Dark = 0,
Cloth, Cloth = 1,
} }
pub const ALL_BELTS: [Belt; 2] = [Belt::Dark, Belt::Cloth]; pub const ALL_BELTS: [Belt; 2] = [Belt::Dark, Belt::Cloth];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Pants { pub enum Pants {
Blue, Blue = 0,
Brown, Brown = 1,
Dark, Dark = 2,
Green, Green = 3,
Orange, Orange = 4,
Kimono, Kimono = 5,
} }
pub const ALL_PANTS: [Pants; 6] = [ pub const ALL_PANTS: [Pants; 6] = [
Pants::Blue, Pants::Blue,
@ -431,47 +437,52 @@ pub const ALL_PANTS: [Pants; 6] = [
]; ];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Hand { pub enum Hand {
Bare, Bare = 0,
Cloth, Cloth = 1,
} }
pub const ALL_HANDS: [Hand; 2] = [Hand::Bare, Hand::Cloth]; pub const ALL_HANDS: [Hand; 2] = [Hand::Bare, Hand::Cloth];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Foot { pub enum Foot {
Bare, Bare = 0,
Dark, Dark = 1,
Sandal, Sandal = 2,
Jester, Jester = 3,
} }
pub const ALL_FEET: [Foot; 4] = [Foot::Bare, Foot::Dark, Foot::Sandal, Foot::Jester]; pub const ALL_FEET: [Foot; 4] = [Foot::Bare, Foot::Dark, Foot::Sandal, Foot::Jester];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Shoulder { pub enum Shoulder {
None, None = 0,
Brown1, Brown1 = 1,
Chain, Chain = 2,
} }
pub const ALL_SHOULDERS: [Shoulder; 3] = [Shoulder::None, Shoulder::Brown1, Shoulder::Chain]; pub const ALL_SHOULDERS: [Shoulder; 3] = [Shoulder::None, Shoulder::Brown1, Shoulder::Chain];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Eyebrows { pub enum Eyebrows {
Yup, Yup = 0,
} }
pub const ALL_EYEBROWS: [Eyebrows; 1] = [Eyebrows::Yup]; pub const ALL_EYEBROWS: [Eyebrows; 1] = [Eyebrows::Yup];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum EyeColor { pub enum EyeColor {
VigorousBlack, VigorousBlack = 0,
NobleBlue, NobleBlue = 1,
CuriousGreen, CuriousGreen = 2,
LoyalBrown, LoyalBrown = 3,
ViciousRed, ViciousRed = 4,
PumpkinOrange, PumpkinOrange = 5,
GhastlyYellow, GhastlyYellow = 6,
MagicPurple, MagicPurple = 7,
ToxicGreen, ToxicGreen = 8,
ExoticPurple, ExoticPurple = 9,
} }
impl EyeColor { impl EyeColor {
pub fn light_rgb(self) -> Rgb<u8> { pub fn light_rgb(self) -> Rgb<u8> {
@ -508,35 +519,37 @@ impl EyeColor {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Accessory { pub enum Accessory {
Nothing, Nothing = 0,
Some, Some = 1,
} }
pub const ALL_ACCESSORIES: [Accessory; 2] = [Accessory::Nothing, Accessory::Some]; pub const ALL_ACCESSORIES: [Accessory; 2] = [Accessory::Nothing, Accessory::Some];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Skin { pub enum Skin {
Pale, Pale = 0,
White, White = 1,
Tanned, Tanned = 2,
Brown, Brown = 3,
TannedBrown, TannedBrown = 4,
TannedDarkBrown, TannedDarkBrown = 5,
Iron, Iron = 6,
Steel, Steel = 7,
DanariOne, DanariOne = 8,
DanariTwo, DanariTwo = 9,
DanariThree, DanariThree = 10,
DanariFour, DanariFour = 11,
ElfOne, ElfOne = 12,
ElfTwo, ElfTwo = 13,
ElfThree, ElfThree = 14,
OrcOne, OrcOne = 15,
OrcTwo, OrcTwo = 16,
OrcThree, OrcThree = 17,
UndeadOne, UndeadOne = 18,
UndeadTwo, UndeadTwo = 19,
UndeadThree, UndeadThree = 20,
} }
impl Skin { impl Skin {
pub fn rgb(self) -> Rgb<u8> { pub fn rgb(self) -> Rgb<u8> {

View File

@ -1,58 +1,59 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Body { pub enum Body {
Arrow, Arrow = 0,
Bomb, Bomb = 1,
Scarecrow, Scarecrow = 2,
Cauldron, Cauldron = 3,
ChestVines, ChestVines = 4,
Chest, Chest = 5,
ChestDark, ChestDark = 6,
ChestDemon, ChestDemon = 7,
ChestGold, ChestGold = 8,
ChestLight, ChestLight = 9,
ChestOpen, ChestOpen = 10,
ChestSkull, ChestSkull = 11,
Pumpkin, Pumpkin = 12,
Pumpkin2, Pumpkin2 = 13,
Pumpkin3, Pumpkin3 = 14,
Pumpkin4, Pumpkin4 = 15,
Pumpkin5, Pumpkin5 = 16,
Campfire, Campfire = 17,
LanternGround, LanternGround = 18,
LanternGroundOpen, LanternGroundOpen = 19,
LanternStanding2, LanternStanding2 = 20,
LanternStanding, LanternStanding = 21,
PotionBlue, PotionBlue = 22,
PotionGreen, PotionGreen = 23,
PotionRed, PotionRed = 24,
Crate, Crate = 25,
Tent, Tent = 26,
WindowSpooky, WindowSpooky = 27,
DoorSpooky, DoorSpooky = 28,
Anvil, Anvil = 29,
Gravestone, Gravestone = 30,
Gravestone2, Gravestone2 = 31,
Bench, Bench = 32,
Chair, Chair = 33,
Chair2, Chair2 = 34,
Chair3, Chair3 = 35,
Table, Table = 36,
Table2, Table2 = 37,
Table3, Table3 = 38,
Drawer, Drawer = 39,
BedBlue, BedBlue = 40,
Carpet, Carpet = 41,
Bedroll, Bedroll = 42,
CarpetHumanRound, CarpetHumanRound = 43,
CarpetHumanSquare, CarpetHumanSquare = 44,
CarpetHumanSquare2, CarpetHumanSquare2 = 45,
CarpetHumanSquircle, CarpetHumanSquircle = 46,
Pouch, Pouch = 47,
CraftingBench, CraftingBench = 48,
BoltFire, BoltFire = 49,
ArrowSnake, ArrowSnake = 50,
} }
impl Body { impl Body {

View File

@ -1,6 +1,7 @@
use rand::{seq::SliceRandom, thread_rng}; use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(C)]
pub struct Body { pub struct Body {
pub head_upper: HeadUpper, pub head_upper: HeadUpper,
pub jaw: Jaw, pub jaw: Jaw,
@ -35,66 +36,77 @@ impl Body {
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum HeadUpper { pub enum HeadUpper {
Default, Default,
} }
const ALL_HEADS_UPPER: [HeadUpper; 1] = [HeadUpper::Default]; const ALL_HEADS_UPPER: [HeadUpper; 1] = [HeadUpper::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Jaw { pub enum Jaw {
Default, Default,
} }
const ALL_JAWS: [Jaw; 1] = [Jaw::Default]; const ALL_JAWS: [Jaw; 1] = [Jaw::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum HeadLower { pub enum HeadLower {
Default, Default,
} }
const ALL_HEADS_LOWER: [HeadLower; 1] = [HeadLower::Default]; const ALL_HEADS_LOWER: [HeadLower; 1] = [HeadLower::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Tail { pub enum Tail {
Default, Default,
} }
const ALL_TAILS: [Tail; 1] = [Tail::Default]; const ALL_TAILS: [Tail; 1] = [Tail::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum TorsoBack { pub enum TorsoBack {
Default, Default,
} }
const ALL_TORSOS_BACK: [TorsoBack; 1] = [TorsoBack::Default]; const ALL_TORSOS_BACK: [TorsoBack; 1] = [TorsoBack::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum TorsoMid { pub enum TorsoMid {
Default, Default,
} }
const ALL_TORSOS_MID: [TorsoMid; 1] = [TorsoMid::Default]; const ALL_TORSOS_MID: [TorsoMid; 1] = [TorsoMid::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Ears { pub enum Ears {
Default, Default,
} }
const ALL_EARS: [Ears; 1] = [Ears::Default]; const ALL_EARS: [Ears; 1] = [Ears::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootLF { pub enum FootLF {
Default, Default,
} }
const ALL_FEETS_LF: [FootLF; 1] = [FootLF::Default]; const ALL_FEETS_LF: [FootLF; 1] = [FootLF::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootRF { pub enum FootRF {
Default, Default,
} }
const ALL_FEETS_RF: [FootRF; 1] = [FootRF::Default]; const ALL_FEETS_RF: [FootRF; 1] = [FootRF::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootLB { pub enum FootLB {
Default, Default,
} }
const ALL_FEETS_LB: [FootLB; 1] = [FootLB::Default]; const ALL_FEETS_LB: [FootLB; 1] = [FootLB::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootRB { pub enum FootRB {
Default, Default,
} }

View File

@ -1,6 +1,6 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![type_length_limit = "1664759"] #![type_length_limit = "1664759"]
#![feature(trait_alias)] #![feature(trait_alias, arbitrary_enum_discriminant)]
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;

View File

@ -5,6 +5,7 @@ use serde_derive::{Deserialize, Serialize};
use std::{fs, io, path::PathBuf}; use std::{fs, io, path::PathBuf};
#[derive(Clone, Debug, Serialize, Deserialize)] #[derive(Clone, Debug, Serialize, Deserialize)]
#[repr(C)]
pub struct CharacterData { pub struct CharacterData {
pub name: String, pub name: String,
pub body: comp::Body, pub body: comp::Body,
@ -12,6 +13,7 @@ pub struct CharacterData {
#[derive(Clone, Debug, Default, Serialize, Deserialize)] #[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[serde(default)] #[serde(default)]
#[repr(C)]
pub struct Meta { pub struct Meta {
pub characters: Vec<CharacterData>, pub characters: Vec<CharacterData>,
pub selected_character: usize, pub selected_character: usize,