Reset controller after each tick

This commit is contained in:
timokoesters 2019-08-23 22:11:14 +02:00
parent 4d6a32e00f
commit 808467c616
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

15
common/src/sys/cleanup.rs Normal file
View File

@ -0,0 +1,15 @@
use crate::comp::Controller;
use specs::{Entities, Join, System, WriteStorage};
use vek::*;
/// This system will allow NPCs to modify their controller
pub struct Sys;
impl<'a> System<'a> for Sys {
type SystemData = (Entities<'a>, WriteStorage<'a, Controller>);
fn run(&mut self, (entities, mut controllers): Self::SystemData) {
for controller in (&mut controllers).join() {
*controller = Controller::default();
}
}
}