diff --git a/common/src/cmd.rs b/common/src/cmd.rs index 1f2fa1365d..cf9033494b 100644 --- a/common/src/cmd.rs +++ b/common/src/cmd.rs @@ -209,10 +209,40 @@ lazy_static! { /// TODO: Make this use hot-reloading static ref ENTITIES: Vec = { let npc_names = &*npc::NPC_NAMES.read(); - npc::ALL_NPCS - .iter() - .map(|&npc| npc_names[npc].keyword.clone()) - .collect() + let mut souls = Vec::new(); + macro_rules! push_souls { + ($species:tt) => { + for s in comp::$species::ALL_SPECIES.iter() { + souls.push(npc_names.$species.species[s].keyword.clone()) + } + }; + ($base:tt, $($species:tt),+ $(,)?) => { + push_souls!($base); + push_souls!($($species),+); + } + } + for npc in npc::ALL_NPCS.iter() { + souls.push(npc_names[*npc].keyword.clone()) + } + + // See `[AllBodies](crate::comp::body::AllBodies)` + push_souls!( + humanoid, + quadruped_small, + quadruped_medium, + quadruped_low, + bird_medium, + bird_large, + fish_small, + fish_medium, + biped_small, + biped_large, + theropod, + dragon, + golem, + ); + + souls }; static ref OBJECTS: Vec = comp::object::ALL_OBJECTS .iter() diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 87237bef92..1f3a3dabbe 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -65,6 +65,8 @@ pub struct BodyData { /// stored for each species for each body. /// /// NOTE: Deliberately don't (yet?) implement serialize. +/// NOTE: If you are adding new body kind and it should be spawned via /spawn +/// please add it to `[ENTITIES](crate::cmd::ENTITIES)` #[derive(Clone, Debug, Deserialize)] pub struct AllBodies { pub humanoid: BodyData>,