Merge branch 'juliancoffee/improve_spawn_cmd_ux' into 'master'

improve /spawn cmd UX

See merge request veloren/veloren!2283
This commit is contained in:
Joshua Yanovski 2021-05-09 20:22:29 +00:00
commit 7ee2d9dfa3
3 changed files with 37 additions and 4 deletions

View File

@ -122,6 +122,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Villagers in safezones no longer spam messages upon seeing an enemy
- Wolf AI will no longer circle into walls and will instead use the power of raycasts to stop early
- Squirrels are no longer immune to arrows at some angles.
- /spawn command's auto-complete now works for species names
## [0.9.0] - 2021-03-20

View File

@ -209,10 +209,40 @@ lazy_static! {
/// TODO: Make this use hot-reloading
static ref ENTITIES: Vec<String> = {
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<String> = comp::object::ALL_OBJECTS
.iter()

View File

@ -65,6 +65,8 @@ pub struct BodyData<BodyMeta, SpeciesData> {
/// 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<BodyMeta, SpeciesMeta> {
pub humanoid: BodyData<BodyMeta, humanoid::AllSpecies<SpeciesMeta>>,