diff options
| author | troido <troido@protonmail.com> | 2020-02-24 12:38:23 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-24 12:38:23 +0100 |
| commit | 715c9106dbff4524f3fdf5d23f762e5e6518e0cb (patch) | |
| tree | cf5dc0c5d30fc9ba7e38bdff40907fe4a96261a2 /src/resources/newentities.rs | |
| parent | 4718cfdc7c2bf67d2389ca18ab035fe5a0887ff0 (diff) | |
healing works now too, the first time based system
Diffstat (limited to 'src/resources/newentities.rs')
| -rw-r--r-- | src/resources/newentities.rs | 28 |
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(()) + } +} |
