summaryrefslogtreecommitdiff
path: root/src/room.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-07 19:54:35 +0100
committertroido <troido@protonmail.com>2020-02-07 19:54:35 +0100
commit8be2749edf97b200281a2c67f97ed8835f5c6d88 (patch)
tree33608330625786a375b20782cbb542757571b031 /src/room.rs
parent7dd148f8e0b371cb422f14dfe926e98642c41317 (diff)
spawn is also loaded from room template
Diffstat (limited to 'src/room.rs')
-rw-r--r--src/room.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/room.rs b/src/room.rs
index 8d15bde..dc7c849 100644
--- a/src/room.rs
+++ b/src/room.rs
@@ -18,7 +18,8 @@ use super::resources::{
Size,
Output,
Input,
- NewEntities
+ NewEntities,
+ Spawn
};
use super::systems::{
moving::Move,
@@ -69,14 +70,16 @@ impl <'a, 'b>Room<'a, 'b> {
self.world.fetch_mut::<Size>().width = width;
self.world.fetch_mut::<Size>().height = height;
- // todo: set spawn
+ self.world.fetch_mut::<Spawn>().pos = template.spawn;
for (idx, templates) in template.field.iter().enumerate() {
let x = (idx as i64) % width;
let y = (idx as i64) / width;
for template in templates {
- self.add_entity(template, Pos{x, y});
+ if let Err(msg) = self.add_entity(template, Pos{x, y}){
+ println!("{}", msg);
+ }
}
}
}