diff options
| author | HampusM <hampus@hampusmat.com> | 2026-10-31 14:46:39 +0100 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-10-31 14:46:39 +0100 |
| commit | 89724815230c4fcab81111f626bd4bb8b12db7bd (patch) | |
| tree | 31e3f90eb35850afb991320bd0cab6f6c75e987d /engine-ecs/src/actions.rs | |
| parent | 2d977a7b3089193080365c66219914081a9347ae (diff) | |
feat(engine-ecs): add Actions fn to create sole
Diffstat (limited to 'engine-ecs/src/actions.rs')
| -rw-r--r-- | engine-ecs/src/actions.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/engine-ecs/src/actions.rs b/engine-ecs/src/actions.rs index cef51cc..f1a1541 100644 --- a/engine-ecs/src/actions.rs +++ b/engine-ecs/src/actions.rs @@ -10,6 +10,7 @@ use crate::component::{ 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; use crate::{ActionQueue, World}; @@ -304,6 +305,16 @@ 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 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) @@ -339,5 +350,6 @@ pub(crate) enum Action pair_id: Uid, new_pair: ComponentParts, }, + CreateSole(ComponentParts), Stop, } |
