veloren/common/src/comp/body/object.rs
2020-01-26 12:52:28 +00:00

120 lines
2.4 KiB
Rust

use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Body {
Arrow = 0,
Bomb = 1,
Scarecrow = 2,
Cauldron = 3,
ChestVines = 4,
Chest = 5,
ChestDark = 6,
ChestDemon = 7,
ChestGold = 8,
ChestLight = 9,
ChestOpen = 10,
ChestSkull = 11,
Pumpkin = 12,
Pumpkin2 = 13,
Pumpkin3 = 14,
Pumpkin4 = 15,
Pumpkin5 = 16,
Campfire = 17,
LanternGround = 18,
LanternGroundOpen = 19,
LanternStanding2 = 20,
LanternStanding = 21,
PotionBlue = 22,
PotionGreen = 23,
PotionRed = 24,
Crate = 25,
Tent = 26,
WindowSpooky = 27,
DoorSpooky = 28,
Anvil = 29,
Gravestone = 30,
Gravestone2 = 31,
Bench = 32,
Chair = 33,
Chair2 = 34,
Chair3 = 35,
Table = 36,
Table2 = 37,
Table3 = 38,
Drawer = 39,
BedBlue = 40,
Carpet = 41,
Bedroll = 42,
CarpetHumanRound = 43,
CarpetHumanSquare = 44,
CarpetHumanSquare2 = 45,
CarpetHumanSquircle = 46,
Pouch = 47,
CraftingBench = 48,
BoltFire = 49,
ArrowSnake = 50,
CampfireLit = 51,
}
impl Body {
pub fn random() -> Self {
let mut rng = thread_rng();
*(&ALL_OBJECTS).choose(&mut rng).unwrap()
}
}
const ALL_OBJECTS: [Body; 51] = [
Body::Arrow,
Body::Bomb,
Body::Scarecrow,
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::CampfireLit,
Body::LanternGround,
Body::LanternGroundOpen,
Body::LanternStanding,
Body::LanternStanding2,
Body::PotionRed,
Body::PotionBlue,
Body::PotionGreen,
Body::Crate,
Body::Tent,
Body::WindowSpooky,
Body::DoorSpooky,
Body::Anvil,
Body::Gravestone,
Body::Gravestone2,
Body::Bench,
Body::Chair,
Body::Chair2,
Body::Chair3,
Body::Table,
Body::Table2,
Body::Table3,
Body::Drawer,
Body::BedBlue,
Body::Carpet,
Body::Bedroll,
Body::CarpetHumanRound,
Body::CarpetHumanSquare,
Body::CarpetHumanSquare2,
Body::CarpetHumanSquircle,
Body::CraftingBench,
Body::BoltFire,
Body::ArrowSnake,
];