summaryrefslogtreecommitdiff
path: root/ecs/src/actions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/actions.rs')
-rw-r--r--ecs/src/actions.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/ecs/src/actions.rs b/ecs/src/actions.rs
index 5cd7b00..72cc95d 100644
--- a/ecs/src/actions.rs
+++ b/ecs/src/actions.rs
@@ -7,8 +7,8 @@ use crate::component::{
Metadata as ComponentMetadata,
Sequence as ComponentSequence,
};
-use crate::entity::Uid as EntityUid;
use crate::system::{NoInitParamFlag, Param as SystemParam, System};
+use crate::uid::{Kind as UidKind, Uid};
use crate::{ActionQueue, World};
/// Used to to queue up actions for a [`World`] to perform.
@@ -28,19 +28,23 @@ impl<'world> Actions<'world>
}
/// Adds component(s) to a entity.
- pub fn add_components<Comps>(&mut self, entity_uid: EntityUid, components: Comps)
+ pub fn add_components<Comps>(&mut self, entity_uid: Uid, components: Comps)
where
Comps: ComponentSequence,
{
+ debug_assert_eq!(entity_uid.kind(), UidKind::Entity);
+
self.action_queue
.push(Action::AddComponents(entity_uid, components.into_vec()));
}
/// Removes component(s) from a entity.
- pub fn remove_components<Comps>(&mut self, entity_uid: EntityUid)
+ pub fn remove_components<Comps>(&mut self, entity_uid: Uid)
where
Comps: ComponentSequence,
{
+ debug_assert_eq!(entity_uid.kind(), UidKind::Entity);
+
self.action_queue
.push(Action::RemoveComponents(entity_uid, Comps::metadata()));
}
@@ -149,8 +153,8 @@ impl<'weak_ref> Ref<'weak_ref>
pub(crate) enum Action
{
Spawn(Vec<Box<dyn Component>>),
- AddComponents(EntityUid, Vec<Box<dyn Component>>),
- RemoveComponents(EntityUid, Vec<ComponentMetadata>),
+ AddComponents(Uid, Vec<Box<dyn Component>>),
+ RemoveComponents(Uid, Vec<ComponentMetadata>),
Stop,
}