diff options
Diffstat (limited to 'engine-ecs/src/actions.rs')
| -rw-r--r-- | engine-ecs/src/actions.rs | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/engine-ecs/src/actions.rs b/engine-ecs/src/actions.rs index 9ca9198..c367f6e 100644 --- a/engine-ecs/src/actions.rs +++ b/engine-ecs/src/actions.rs @@ -1,11 +1,7 @@ use std::borrow::Cow; -use crate::component::{ - Component, - IntoParts, - Parts as ComponentParts, - Sequence as ComponentSequence, -}; +use crate::bundle::Bundle; +use crate::component::{Component, IntoParts, Parts as ComponentParts}; use crate::entity::Name as EntityName; use crate::event::component::Removed; use crate::pair::Pair; @@ -25,11 +21,11 @@ impl Actions<'_> { /// Queues up a entity to spawn at the end of the current tick, returning the [`Uid`] /// that the entity will have. - pub fn spawn<Comps: ComponentSequence>(&mut self, components: Comps) -> Uid + pub fn spawn<BundleT: Bundle>(&mut self, bundle: BundleT) -> Uid { let new_entity_uid = Uid::new_unique(); - let components_parts = components.into_parts_array(); + let components_parts = bundle.into_parts_array(); if let Some(comp_parts) = components_parts .as_ref() @@ -53,15 +49,15 @@ impl Actions<'_> /// /// In addition to the given components, the entity will have a [`EntityName`] /// component containing `name`. - pub fn spawn_named<Comps: ComponentSequence>( + pub fn spawn_named<BundleT: Bundle>( &mut self, name: impl Into<Cow<'static, str>>, - components: Comps, + bundle: BundleT, ) -> Uid { let new_entity_uid = Uid::new_unique(); - let components_parts = components.into_parts_array(); + let components_parts = bundle.into_parts_array(); if let Some(comp_parts) = components_parts .as_ref() @@ -119,17 +115,15 @@ impl Actions<'_> } /// Queues up adding component(s) to a entity at the end of the current tick. - pub fn add_components<Comps>(&mut self, entity_uid: Uid, components: Comps) - where - Comps: ComponentSequence, + pub fn add_components<BundleT: Bundle>(&mut self, entity_uid: Uid, bundle: BundleT) { debug_assert!(!entity_uid.is_pair()); - if components.cnt() == 0 { + if bundle.cnt() == 0 { return; } - let components_parts = components.into_parts_array(); + let components_parts = bundle.into_parts_array(); if let Some(comp_parts) = components_parts .as_ref() |
