diff options
Diffstat (limited to 'src/systems/clearcontrols.rs')
| -rw-r--r-- | src/systems/clearcontrols.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/systems/clearcontrols.rs b/src/systems/clearcontrols.rs new file mode 100644 index 0000000..ec2bb68 --- /dev/null +++ b/src/systems/clearcontrols.rs @@ -0,0 +1,25 @@ + +use specs::{ + WriteStorage, + Entities, + System, + Join +}; + +use super::super::components::Controller; + +pub struct ClearControllers; +impl <'a> System<'a> for ClearControllers { + type SystemData = (Entities<'a>, WriteStorage<'a, Controller>); + fn run(&mut self, (entities, mut controllers): Self::SystemData) { + let mut ents = Vec::new(); + for (ent, _controller) in (&*entities, &controllers).join() { + ents.push(ent); + } + for ent in ents { + controllers.remove(ent); + } + } +} + + |
