From 323cd679cd29a8475c3b7486ce54ecd37620dbea Mon Sep 17 00:00:00 2001 From: troido Date: Tue, 4 Feb 2020 22:23:17 +0100 Subject: tried to implement deserialisation of entities --- src/room.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/room.rs') diff --git a/src/room.rs b/src/room.rs index 5eaee8e..4fcf658 100644 --- a/src/room.rs +++ b/src/room.rs @@ -28,6 +28,7 @@ use super::systems::{ controlinput::ControlInput, view::View }; +use super::compwrapper::CompWrapper; @@ -82,6 +83,14 @@ impl <'a, 'b>Room<'a, 'b> { pub fn add_obj(&mut self, template: &dyn Assemblage, (x, y): (i32, i32)) -> Entity { template.build(self.world.create_entity()).with(Position::new(Pos{x, y})).build() } + + pub fn add_complist(&mut self, template: &Vec, (x, y): (i32, i32)) -> Entity{ + let mut builder = self.world.create_entity(); + for comp in template { + builder = comp.build(builder); + } + builder.with(Position::new(Pos{x, y})).build() + } } -- cgit