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

108 lines
1.9 KiB
Rust
Raw Normal View History

2019-07-21 12:42:45 +00:00
use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Body {
Bomb,
Scarecrow,
2019-07-22 12:23:22 +00:00
Cauldron,
ChestVines,
2019-07-21 12:42:45 +00:00
Chest,
ChestDark,
ChestDemon,
ChestGold,
ChestLight,
ChestOpen,
ChestSkull,
Pumpkin,
Pumpkin2,
Pumpkin3,
Pumpkin4,
Pumpkin5,
Campfire,
LanternGround,
LanternGroundOpen,
LanternStanding2,
LanternStanding,
PotionBlue,
PotionGreen,
PotionRed,
Crate,
2019-07-23 23:21:37 +00:00
Tent,
2019-07-24 00:49:16 +00:00
WindowSpooky,
DoorSpooky,
Anvil,
Gravestone,
2019-07-24 00:49:16 +00:00
Gravestone2,
Bench,
Chair,
Chair2,
Chair3,
2019-07-24 00:49:16 +00:00
Table,
Table2,
Table3,
2019-07-24 00:49:16 +00:00
Drawer,
BedBlue,
Carpet,
Bedroll,
CarpetHumanRound,
CarpetHumanSquare,
CarpetHumanSquare2,
CarpetHumanSquircle,
2019-07-21 12:42:45 +00:00
}
impl Body {
pub fn random() -> Self {
let mut rng = thread_rng();
*(&ALL_OBJECTS).choose(&mut rng).unwrap()
}
}
const ALL_OBJECTS: [Body; 46] = [
Body::Bomb,
Body::Scarecrow,
2019-07-22 12:23:22 +00:00
Body::Cauldron,
Body::ChestVines,
Body::Chest,
Body::ChestDark,
Body::ChestDemon,
Body::ChestGold,
Body::ChestLight,
Body::ChestOpen,
Body::ChestSkull,
Body::Pumpkin,
Body::Pumpkin2,
Body::Pumpkin3,
Body::Pumpkin4,
Body::Pumpkin5,
Body::Campfire,
Body::LanternGround,
Body::LanternGroundOpen,
Body::LanternStanding,
Body::LanternStanding2,
Body::PotionRed,
Body::PotionBlue,
Body::PotionGreen,
Body::Crate,
2019-07-23 23:21:37 +00:00
Body::Tent,
2019-07-24 00:49:16 +00:00
Body::WindowSpooky,
Body::DoorSpooky,
Body::Anvil,
Body::Gravestone,
2019-07-24 00:49:16 +00:00
Body::Gravestone2,
Body::Bench,
Body::Chair,
Body::Chair2,
Body::Chair3,
2019-07-24 00:49:16 +00:00
Body::Table,
Body::Table2,
Body::Table3,
2019-07-24 00:49:16 +00:00
Body::Drawer,
Body::BedBlue,
Body::Carpet,
Body::Bedroll,
Body::CarpetHumanRound,
Body::CarpetHumanSquare,
Body::CarpetHumanSquare2,
Body::CarpetHumanSquircle,
];