2019-10-24 23:42:33 +00:00
|
|
|
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)]
|
2020-01-20 14:21:06 +00:00
|
|
|
#[repr(u32)]
|
2019-10-24 23:42:33 +00:00
|
|
|
pub enum Torso {
|
|
|
|
Default,
|
|
|
|
}
|
|
|
|
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
2020-01-20 14:21:06 +00:00
|
|
|
#[repr(u32)]
|
2019-10-24 23:42:33 +00:00
|
|
|
pub enum Tail {
|
|
|
|
Default,
|
|
|
|
}
|
2019-10-25 01:26:32 +00:00
|
|
|
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|