mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
19 lines
413 B
Rust
19 lines
413 B
Rust
|
use rand::{seq::SliceRandom, thread_rng};
|
||
|
|
||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||
|
pub enum Body {
|
||
|
Bomb,
|
||
|
Scarecrow,
|
||
|
Chest,
|
||
|
Pumpkin,
|
||
|
}
|
||
|
|
||
|
impl Body {
|
||
|
pub fn random() -> Self {
|
||
|
let mut rng = thread_rng();
|
||
|
*(&ALL_OBJECTS).choose(&mut rng).unwrap()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const ALL_OBJECTS: [Body; 4] = [Body::Bomb, Body::Scarecrow, Body::Chest, Body::Pumpkin];
|