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/room.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/room.rs') diff --git a/src/room.rs b/src/room.rs index e19d689..3856cbd 100644 --- a/src/room.rs +++ b/src/room.rs @@ -21,7 +21,8 @@ use crate::{ NewEntities, Spawn, Players, - Emigration + Emigration, + TimeStamp }, systems::{ Move, @@ -35,7 +36,8 @@ use crate::{ Use, Attacking, Trapping, - Fight + Fight, + Heal }, components::{ Position, @@ -79,13 +81,14 @@ impl <'a, 'b>Room<'a, 'b> { let mut dispatcher = DispatcherBuilder::new() .with(RegisterNew::default(), "registernew", &[]) - .with(ControlInput, "controlinput", &[]) + .with(ControlInput, "controlinput", &["registernew"]) .with(Take, "take", &["controlinput"]) .with(Use, "use", &["controlinput"]) .with(Move, "move", &["registernew", "controlinput"]) .with(Trapping, "trapping", &["move"]) .with(Fight, "fight", &["move", "controlinput"]) - .with(Attacking, "attacking", &["use", "trapping", "fight"]) + .with(Heal, "heal", &["registernew"]) + .with(Attacking, "attacking", &["use", "trapping", "fight", "heal"]) .with(View::default(), "view", &["move", "attacking"]) .with(Migrate, "migrate", &["view"]) .with(Create, "create", &["view", "controlinput"]) @@ -135,7 +138,8 @@ impl <'a, 'b>Room<'a, 'b> { self.world.fetch::().output.clone() } - pub fn update(&mut self) { + pub fn update(&mut self, timestamp: i64) { + self.world.fetch_mut::().time = timestamp; self.dispatcher.dispatch(&self.world); self.world.maintain(); } -- cgit