summaryrefslogtreecommitdiff
path: root/src/systems
diff options
context:
space:
mode:
Diffstat (limited to 'src/systems')
-rw-r--r--src/systems/interact.rs23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/systems/interact.rs b/src/systems/interact.rs
index 6df0066..c3cd0d2 100644
--- a/src/systems/interact.rs
+++ b/src/systems/interact.rs
@@ -20,10 +20,13 @@ use crate::{
Notification,
Ear,
Inventory,
- Visible
+ Visible,
+ Player
},
controls::{Control},
- resources::{Ground, NewEntities}
+ resources::{Ground, NewEntities, Emigration},
+ hashmap,
+ playerstate::RoomPos
};
pub struct Interact;
@@ -39,10 +42,12 @@ impl <'a> System<'a> for Interact {
Write<'a, NewEntities>,
WriteStorage<'a, Ear>,
WriteStorage<'a, Inventory>,
- ReadStorage<'a, Visible>
+ ReadStorage<'a, Visible>,
+ ReadStorage<'a, Player>,
+ Write<'a, Emigration>
);
- fn run(&mut self, (entities, controllers, positions, ground, mut cooldowns, interactables, mut triggerbox, new, mut ears, mut inventories, visibles): Self::SystemData) {
+ fn run(&mut self, (entities, controllers, positions, ground, mut cooldowns, interactables, mut triggerbox, new, mut ears, mut inventories, visibles, players, mut emigration): Self::SystemData) {
for (entity, controller, position) in (&entities, &controllers, &positions).join(){
let mut target = None;
let ear = ears.get_mut(entity);
@@ -101,6 +106,16 @@ impl <'a> System<'a> for Interact {
);
}
}
+ Interactable::Visit(dest) => {
+ if let Some(player) = players.get(entity){
+ let argument = arg.unwrap();
+ if argument.starts_with("visit") {
+ let playername = argument.split_at("visit ".len()).1;
+ let destination = dest.format(hashmap!("{player}" => playername));
+ emigration.emigrants.push((player.id.clone(), destination, RoomPos::Unknown));
+ }
+ }
+ }
}
cooldowns.insert(entity, ControlCooldown{amount: 2}).unwrap();
}