summaryrefslogtreecommitdiff
path: root/src/resources/newentities.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/newentities.rs')
-rw-r--r--src/resources/newentities.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/resources/newentities.rs b/src/resources/newentities.rs
new file mode 100644
index 0000000..a9c4ddc
--- /dev/null
+++ b/src/resources/newentities.rs
@@ -0,0 +1,28 @@
+
+use crate::{
+ Pos,
+ Encyclopedia,
+ Template,
+ Result,
+ componentwrapper::PreEntity
+};
+
+#[derive(Default)]
+pub struct NewEntities {
+ pub to_build: Vec<(Pos, PreEntity)>,
+ pub encyclopedia: Encyclopedia
+}
+
+impl NewEntities {
+ pub fn new(encyclopedia: Encyclopedia) -> Self {
+ Self{
+ to_build: Vec::new(),
+ encyclopedia
+ }
+ }
+ pub fn create(&mut self, pos: Pos, template: Template) -> Result<()> {
+ let components = self.encyclopedia.construct(&template)?;
+ self.to_build.push((pos, components));
+ Ok(())
+ }
+}