diff options
Diffstat (limited to 'ecs/src/actions.rs')
-rw-r--r-- | ecs/src/actions.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ecs/src/actions.rs b/ecs/src/actions.rs index 35e9569..0878067 100644 --- a/ecs/src/actions.rs +++ b/ecs/src/actions.rs @@ -29,6 +29,14 @@ impl<'world> Actions<'world> )); } + /// Queues up despawning a entity at the end of the current tick. + pub fn despawn(&mut self, entity_uid: Uid) + { + debug_assert_eq!(entity_uid.kind(), UidKind::Entity); + + self.action_queue.push(Action::Despawn(entity_uid)); + } + /// 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 @@ -155,6 +163,7 @@ pub(crate) struct EventIds pub(crate) enum Action { Spawn(Vec<Box<dyn Component>>, EventIds), + Despawn(Uid), AddComponents(Uid, Vec<Box<dyn Component>>, EventIds), RemoveComponents(Uid, Vec<ComponentMetadata>, EventIds), Stop, |