add world.insert passthrough to entitybuilder
This commit is contained in:
parent
cd6ccc45b1
commit
649e1b113f
@ -1,5 +1,5 @@
|
|||||||
use crate::ecs::EntityArchetype;
|
use crate::ecs::EntityArchetype;
|
||||||
use legion::prelude::*;
|
use legion::{world::{TagSet, TagLayout, IntoComponentSource}, prelude::*, filter::{Filter, ChunksetFilterData}};
|
||||||
|
|
||||||
pub trait EntityBuilderSource {
|
pub trait EntityBuilderSource {
|
||||||
fn build(&mut self) -> EntityBuilder;
|
fn build(&mut self) -> EntityBuilder;
|
||||||
@ -48,6 +48,15 @@ impl<'a> EntityBuilder<'a> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn add_entities<T,C>(self, tags: T, components: C) -> Self
|
||||||
|
where
|
||||||
|
T: TagSet + TagLayout + for<'b> Filter<ChunksetFilterData<'b>>,
|
||||||
|
C: IntoComponentSource,
|
||||||
|
{
|
||||||
|
self.world.insert(tags, components);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_archetype(mut self, entity_archetype: impl EntityArchetype) -> Self {
|
pub fn add_archetype(mut self, entity_archetype: impl EntityArchetype) -> Self {
|
||||||
self.current_entity = Some(entity_archetype.insert(self.world));
|
self.current_entity = Some(entity_archetype.insert(self.world));
|
||||||
self
|
self
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user