mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
add world.insert passthrough to entitybuilder
This commit is contained in:
parent
cd6ccc45b1
commit
649e1b113f
1 changed files with 10 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
use crate::ecs::EntityArchetype;
|
||||
use legion::prelude::*;
|
||||
use legion::{world::{TagSet, TagLayout, IntoComponentSource}, prelude::*, filter::{Filter, ChunksetFilterData}};
|
||||
|
||||
pub trait EntityBuilderSource {
|
||||
fn build(&mut self) -> EntityBuilder;
|
||||
|
@ -48,6 +48,15 @@ impl<'a> EntityBuilder<'a> {
|
|||
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 {
|
||||
self.current_entity = Some(entity_archetype.insert(self.world));
|
||||
self
|
||||
|
|
Loading…
Add table
Reference in a new issue