2020-08-31 01:01:20 +00:00
|
|
|
use crate::{make_case_elim, make_proj_elim};
|
2019-10-24 23:42:33 +00:00
|
|
|
use rand::{seq::SliceRandom, thread_rng};
|
2020-07-06 14:23:08 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2019-10-24 23:42:33 +00:00
|
|
|
|
2020-08-31 01:01:20 +00:00
|
|
|
make_proj_elim!(
|
|
|
|
body,
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
pub struct Body {
|
|
|
|
pub torso: Torso,
|
|
|
|
pub tail: Tail,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2019-10-24 23:42:33 +00:00
|
|
|
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(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-31 01:01:20 +00:00
|
|
|
make_case_elim!(
|
|
|
|
torso,
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
#[repr(u32)]
|
|
|
|
pub enum Torso {
|
|
|
|
Default = 0,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2019-10-24 23:42:33 +00:00
|
|
|
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
|
|
|
|
2020-08-31 01:01:20 +00:00
|
|
|
make_case_elim!(
|
|
|
|
tail,
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
#[repr(u32)]
|
|
|
|
pub enum Tail {
|
|
|
|
Default = 0,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2019-10-25 01:26:32 +00:00
|
|
|
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|