summaryrefslogtreecommitdiff
path: root/src/systems/create.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-09 18:53:27 +0100
committertroido <troido@protonmail.com>2020-02-09 18:53:27 +0100
commit105c5ab0c0e969f3fda2cd43ae5195cbdb4da016 (patch)
tree46b65b3e96d9b180bf6658cb968a149eb3cfde0f /src/systems/create.rs
parentb1da31499de4145b1f77296cbea0c637e6f866bf (diff)
Revert "no templates in the world; only pre-entities"
This reverts commit b56add981c2f520789b97d1ee6f71dae41e8c900.
Diffstat (limited to 'src/systems/create.rs')
-rw-r--r--src/systems/create.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/systems/create.rs b/src/systems/create.rs
index 054dc1f..35ef747 100644
--- a/src/systems/create.rs
+++ b/src/systems/create.rs
@@ -34,13 +34,18 @@ impl <'a> System<'a> for Create {
new.remove(ent);
}
}
- for (pos, comps) in &new_entities.ents {
+ for (pos, template) in &new_entities.templates {
let mut builder = updater.create_entity(&entities);
- for comp in comps {
- builder = comp.build(builder);
+ match new_entities.encyclopedia.construct(template) {
+ Ok(comps) => {
+ for comp in comps {
+ builder = comp.build(builder);
+ }
+ builder.with(Position::new(*pos)).with(New).build();
+ },
+ Err(msg) => {println!("{}", msg);}
}
- builder.with(Position::new(*pos)).with(New).build();
}
- new_entities.ents.clear();
+ new_entities.templates.clear();
}
}