diff --git a/common/src/sys/animation.rs b/common/src/sys/animation.rs index 0978dd0c9c..df376112fa 100644 --- a/common/src/sys/animation.rs +++ b/common/src/sys/animation.rs @@ -4,7 +4,7 @@ use vek::*; // Crate use crate::{ - comp::{phys::Pos, ActionState, ActionEvent, Control, Stats}, + comp::{phys::Pos, Animation, AnimationInfo, Control, Stats}, state::DeltaTime, }; @@ -12,14 +12,12 @@ use crate::{ pub struct Sys; impl<'a> System<'a> for Sys { - type SystemData = ( - Read<'a, DeltaTime>, - WriteStorage<'a, ActionState>, - ); + type SystemData = (Read<'a, DeltaTime>, WriteStorage<'a, AnimationInfo>); - fn run(&mut self, (dt, mut action_states): Self::SystemData) { - for (dt, mut animation) in (dt, &mut animation).join() { - animation.time += dt.0 as f64; + fn run(&mut self, (dt, mut animation_infos): Self::SystemData) { + for (mut animation_info) in (&mut animation_infos).join() { + animation_info.time += dt.0 as f64; + &animation_info.time; } } } diff --git a/common/src/sys/mod.rs b/common/src/sys/mod.rs index cc242e6cbf..c27ecee387 100644 --- a/common/src/sys/mod.rs +++ b/common/src/sys/mod.rs @@ -1,5 +1,6 @@ pub mod action; pub mod agent; +pub mod animation; pub mod control; pub mod phys; mod stats; @@ -14,6 +15,7 @@ const PHYS_SYS: &str = "phys_sys"; const ANIM_SYS: &str = "anim_sys"; const MOVEMENT_SYS: &str = "movement_sys"; const ACTION_SYS: &str = "action_sys"; +const ANIMATION_SYS: &str = "animation_sys"; const STATS_SYS: &str = "stats_sys"; pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { @@ -23,5 +25,6 @@ pub fn add_local_systems(dispatch_builder: &mut DispatcherBuilder) { dispatch_builder.add(anim::Sys, ANIM_SYS, &[]); dispatch_builder.add(agent::Sys, AGENT_SYS, &[]); dispatch_builder.add(action::Sys, ACTION_SYS, &[]); + dispatch_builder.add(animation::Sys, ANIMATION_SYS, &[]); dispatch_builder.add(stats::Sys, STATS_SYS, &[ACTION_SYS]); }