summaryrefslogtreecommitdiff
path: root/engine-ecs/src/actions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'engine-ecs/src/actions.rs')
-rw-r--r--engine-ecs/src/actions.rs25
1 files changed, 21 insertions, 4 deletions
diff --git a/engine-ecs/src/actions.rs b/engine-ecs/src/actions.rs
index 69605b3..bbc19c6 100644
--- a/engine-ecs/src/actions.rs
+++ b/engine-ecs/src/actions.rs
@@ -1,12 +1,18 @@
use std::borrow::Cow;
use crate::bundle::Bundle;
-use crate::component::{Component, IntoParts, Parts as ComponentParts};
+use crate::component::{
+ Component,
+ IntoParts,
+ Parts as ComponentParts,
+ RemovableTuple as RemovableComponentTuple,
+};
use crate::entity::Name as EntityName;
use crate::event::component::Removed;
use crate::pair::Pair;
+use crate::sole::Sole;
use crate::system::{Metadata as SystemMetadata, Param as SystemParam};
-use crate::uid::{Uid, WithUidTuple};
+use crate::uid::Uid;
use crate::{ActionQueue, World};
/// Used to to queue up actions for a [`World`] to perform.
@@ -174,9 +180,9 @@ impl Actions<'_>
}
/// Queues up removing component(s) from a entity at the end of the current tick.
- pub fn remove_comps<Ids: WithUidTuple>(&mut self, entity_uid: Uid)
+ pub fn remove_comps<Components: RemovableComponentTuple>(&mut self, entity_uid: Uid)
{
- self.remove_components(entity_uid, Ids::uids());
+ self.remove_components(entity_uid, Components::ids());
}
/// Queues up setting the target of a entity's pair at the end of the current tick.
@@ -299,6 +305,16 @@ impl Actions<'_>
});
}
+ /// Queues up creation of a sole at the end of the current tick, returning the [`Uid`]
+ /// of the sole.
+ pub fn create_sole<SoleT: Sole>(&mut self, sole: SoleT) -> Uid
+ {
+ self.action_queue
+ .push(Action::CreateSole(sole.into_parts()));
+
+ SoleT::id()
+ }
+
/// Stops the [`World`]. The world will finish the current tick and that tick will be
/// the last.
pub fn stop(&mut self)
@@ -334,5 +350,6 @@ pub(crate) enum Action
pair_id: Uid,
new_pair: ComponentParts,
},
+ CreateSole(ComponentParts),
Stop,
}