summaryrefslogtreecommitdiff
path: root/src/systems
diff options
context:
space:
mode:
Diffstat (limited to 'src/systems')
-rw-r--r--src/systems/controlinput.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/systems/controlinput.rs b/src/systems/controlinput.rs
index b25c336..27ef5cf 100644
--- a/src/systems/controlinput.rs
+++ b/src/systems/controlinput.rs
@@ -11,10 +11,9 @@ use specs::{
Join
};
-use crate::pos::Pos;
use crate::components::{Controller, Player};
use crate::controls::{Control, Action};
-use crate::resources::{Input, NewEntities};
+use crate::resources::{Input, NewEntities, Spawn};
use crate::hashmap;
use crate::template::Template;
use crate::parameter::Parameter;
@@ -24,15 +23,15 @@ use crate::parameter::Parameter;
pub struct ControlInput;
impl <'a> System<'a> for ControlInput {
- type SystemData = (Entities<'a>, Read<'a, Input>, WriteStorage<'a, Controller>, ReadStorage<'a, Player>, Write<'a, NewEntities>);
- fn run(&mut self, (entities, input, mut controllers, players, mut new): Self::SystemData) {
+ type SystemData = (Entities<'a>, Read<'a, Input>, WriteStorage<'a, Controller>, ReadStorage<'a, Player>, Write<'a, NewEntities>, Read<'a, Spawn>);
+ fn run(&mut self, (entities, input, mut controllers, players, mut new, spawn): Self::SystemData) {
let mut playercontrols: HashMap<&str, Control> = HashMap::new();
let mut leaving = HashSet::new();
for action in &input.actions {
match action {
Action::Join(name) => {
new.templates.push((
- Pos{x:10, y:10},
+ spawn.pos,
Template::new("player", hashmap!("name".to_string() => Parameter::String(name.to_string())))
));
}