From 715c9106dbff4524f3fdf5d23f762e5e6518e0cb Mon Sep 17 00:00:00 2001 From: troido Date: Mon, 24 Feb 2020 12:38:23 +0100 Subject: healing works now too, the first time based system --- src/resources/newentities.rs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/resources/newentities.rs (limited to 'src/resources/newentities.rs') 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(()) + } +} -- cgit