mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add species to /spawn auto-complete
This commit is contained in:
parent
587b48871d
commit
d3be89f5eb
@ -209,10 +209,40 @@ lazy_static! {
|
|||||||
/// TODO: Make this use hot-reloading
|
/// TODO: Make this use hot-reloading
|
||||||
static ref ENTITIES: Vec<String> = {
|
static ref ENTITIES: Vec<String> = {
|
||||||
let npc_names = &*npc::NPC_NAMES.read();
|
let npc_names = &*npc::NPC_NAMES.read();
|
||||||
npc::ALL_NPCS
|
let mut souls = Vec::new();
|
||||||
.iter()
|
macro_rules! push_souls {
|
||||||
.map(|&npc| npc_names[npc].keyword.clone())
|
($species:tt) => {
|
||||||
.collect()
|
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<String> = comp::object::ALL_OBJECTS
|
static ref OBJECTS: Vec<String> = comp::object::ALL_OBJECTS
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -65,6 +65,8 @@ pub struct BodyData<BodyMeta, SpeciesData> {
|
|||||||
/// stored for each species for each body.
|
/// stored for each species for each body.
|
||||||
///
|
///
|
||||||
/// NOTE: Deliberately don't (yet?) implement serialize.
|
/// 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)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
pub struct AllBodies<BodyMeta, SpeciesMeta> {
|
pub struct AllBodies<BodyMeta, SpeciesMeta> {
|
||||||
pub humanoid: BodyData<BodyMeta, humanoid::AllSpecies<SpeciesMeta>>,
|
pub humanoid: BodyData<BodyMeta, humanoid::AllSpecies<SpeciesMeta>>,
|
||||||
|
Loading…
Reference in New Issue
Block a user