diff options
| author | troido <troido@protonmail.com> | 2020-02-23 23:44:50 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-23 23:44:50 +0100 |
| commit | 86cdc6c567d0ca429d69bebbb2fb02f1d3754c8d (patch) | |
| tree | d70eb9d9f014c9cdbf301772c339f22ee5e3ab82 /src/systems/useitem.rs | |
| parent | f422238d7aaae0ff1b2d560a71a99b0a881ad338 (diff) | |
players can now attack other objects
Diffstat (limited to 'src/systems/useitem.rs')
| -rw-r--r-- | src/systems/useitem.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/systems/useitem.rs b/src/systems/useitem.rs index 4317162..c9bcfcd 100644 --- a/src/systems/useitem.rs +++ b/src/systems/useitem.rs @@ -14,7 +14,8 @@ use crate::{ Controller, Position, Inventory, - Attacked + Attacked, + add_attack }, resources::{NewEntities}, components::item::ItemAction::{None, Build, Eat}, @@ -45,12 +46,7 @@ impl <'a> System<'a> for Use { inventory.items.remove(*rank); } Eat(health_diff) => { - attacked - .entry(ent) - .unwrap() - .or_insert_with(Attacked::default) - .attacks - .push(Attack::new(-*health_diff)); + add_attack(&mut attacked, ent, Attack::new(-*health_diff)); inventory.items.remove(*rank); } None => {} |
