veloren/common/src/comp/body/fish_small.rs

29 lines
721 B
Rust
Raw Normal View History

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)]
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];