diff options
| author | troido <troido@protonmail.com> | 2020-02-07 15:05:59 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-07 15:05:59 +0100 |
| commit | bed274c683ffd18a55282247d47780c4f1bf84b5 (patch) | |
| tree | 6e20e6ba099da68354e30b7f7450019188165159 /src/systems/controlinput.rs | |
| parent | 70db58f688f0dbdd69231da570cf8dbb54e5ca81 (diff) | |
all entity construction now uses new templates
Diffstat (limited to 'src/systems/controlinput.rs')
| -rw-r--r-- | src/systems/controlinput.rs | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/systems/controlinput.rs b/src/systems/controlinput.rs index 2de9d29..e5f0151 100644 --- a/src/systems/controlinput.rs +++ b/src/systems/controlinput.rs @@ -12,24 +12,14 @@ use specs::{ }; use crate::pos::Pos; +use crate::components::{Controller, Played}; +use crate::controls::{Control, Action}; +use crate::resources::{Input, NewEntities}; +use crate::hashmap; +use crate::template::Template; +use crate::parameter::Parameter; -use crate::components::{ - Controller, - Played -}; - -use crate::controls::{ - Control, - Action -}; - -use crate::resources::{ - Input, - NewEntities -}; - - -use crate::assemblages::Player; +// use crate::assemblages::Player; pub struct ControlInput; @@ -40,7 +30,12 @@ impl <'a> System<'a> for ControlInput { let mut leaving = HashSet::new(); for action in &input.actions { match action { - Action::Join(name) => {new.assemblages.push((Pos{x:10, y:10}, Box::new(Player::new(&name))));} + Action::Join(name) => { + new.templates.push(( + Pos{x:10, y:10}, + Template::new("player", hashmap!("name".to_string() => Parameter::String(name.to_string()))) + )); + } Action::Leave(name) => {leaving.insert(name);} Action::Input(name, control) => {playercontrols.insert(name, control.clone());} } |
