summaryrefslogtreecommitdiff
path: root/src/systems
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-09 15:04:54 +0200
committertroido <troido@protonmail.com>2020-04-09 15:04:54 +0200
commite7b4ed0f044c3ada82155f81d3b61c0c5ce36583 (patch)
treeebdf7c9b712c07fcb89a1b50fb2a653fa749932d /src/systems
parent8dbe1f51ff1705f97a191197b3ee7cb66b682584 (diff)
change interaction is now a combination of harvest and loot
Diffstat (limited to 'src/systems')
-rw-r--r--src/systems/interact.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/systems/interact.rs b/src/systems/interact.rs
index 43c355d..fb11488 100644
--- a/src/systems/interact.rs
+++ b/src/systems/interact.rs
@@ -17,7 +17,6 @@ use crate::{
ControlCooldown,
Interactable,
Dead,
- Removed,
Sound,
Ear,
Inventory
@@ -36,13 +35,12 @@ impl <'a> System<'a> for Interact {
WriteStorage<'a, ControlCooldown>,
ReadStorage<'a, Interactable>,
WriteStorage<'a, Dead>,
- WriteStorage<'a, Removed>,
Write<'a, NewEntities>,
WriteStorage<'a, Ear>,
WriteStorage<'a, Inventory>
);
- fn run(&mut self, (entities, controllers, positions, ground, mut cooldowns, interactables, mut deads, mut removeds, mut new, mut ears, mut inventories): Self::SystemData) {
+ fn run(&mut self, (entities, controllers, positions, ground, mut cooldowns, interactables, mut deads, new, mut ears, mut inventories): Self::SystemData) {
for (entity, controller, position) in (&entities, &controllers, &positions).join(){
let mut target = None;
let ear = ears.get_mut(entity);
@@ -53,7 +51,7 @@ impl <'a> System<'a> for Interact {
for ent in ground.cells.get(&pos).unwrap_or(&HashSet::new()) {
if let Some(interactable) = interactables.get(*ent) {
if interactable.accepts_arg(arg){
- target = Some((*ent, interactable, pos, arg.clone()));
+ target = Some((*ent, interactable, arg.clone()));
break 'targets;
}
}
@@ -62,15 +60,11 @@ impl <'a> System<'a> for Interact {
}
_ => {}
}
- if let Some((ent, interactable, pos, arg)) = target {
+ if let Some((ent, interactable, arg)) = target {
match interactable {
Interactable::Harvest => {
deads.insert(ent, Dead).unwrap();
}
- Interactable::Change(into) => {
- new.create(pos, into).unwrap();
- removeds.insert(ent, Removed).unwrap();
- }
Interactable::Say(text) => {
say(ear, text.clone());
}