summaryrefslogtreecommitdiff
path: root/src/systems/trapping.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-02-23 23:44:50 +0100
committertroido <troido@protonmail.com>2020-02-23 23:44:50 +0100
commit86cdc6c567d0ca429d69bebbb2fb02f1d3754c8d (patch)
treed70eb9d9f014c9cdbf301772c339f22ee5e3ab82 /src/systems/trapping.rs
parentf422238d7aaae0ff1b2d560a71a99b0a881ad338 (diff)
players can now attack other objects
Diffstat (limited to 'src/systems/trapping.rs')
-rw-r--r--src/systems/trapping.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/systems/trapping.rs b/src/systems/trapping.rs
index 144cd94..5e0921e 100644
--- a/src/systems/trapping.rs
+++ b/src/systems/trapping.rs
@@ -9,7 +9,7 @@ use specs::{
};
use crate::{
- components::{Health, Attacked, Moved, Entered, Trap, Position},
+ components::{Health, Attacked, add_attack, Moved, Entered, Trap, Position},
resources::Ground
};
@@ -31,13 +31,7 @@ impl <'a> System<'a> for Trapping {
for (entity, _entered, trap, position) in (&entities, &entereds, &traps, &positions).join() {
for ent in ground.cells.get(&position.pos).unwrap(){
if ent != &entity && moves.contains(*ent) && healths.contains(*ent) {
- victims
- .entry(*ent)
- .unwrap()
- .or_insert_with(Attacked::default)
- .attacks
- .push(trap.attack.clone());
-
+ add_attack(&mut victims, *ent, trap.attack.clone());
}
}
}