diff options
| author | troido <troido@protonmail.com> | 2020-03-01 22:28:02 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-03-01 22:28:02 +0100 |
| commit | 6a7a74e6878ff04e61e6ef21a922e314b9bab271 (patch) | |
| tree | b26015955f50856052153019969f7bee8d1cfbd3 /src/systems/attacking.rs | |
| parent | c846e929a88837094d7a5383a306df1fec56c333 (diff) | |
use generics for message components
Diffstat (limited to 'src/systems/attacking.rs')
| -rw-r--r-- | src/systems/attacking.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/systems/attacking.rs b/src/systems/attacking.rs index 4b47f11..d28e301 100644 --- a/src/systems/attacking.rs +++ b/src/systems/attacking.rs @@ -9,7 +9,7 @@ use specs::{ }; use crate::{ - components::{Health, Attacked, Dying, Removed, Position}, + components::{Health, AttackInbox, Dying, Removed, Position}, resources::NewEntities, Template, util @@ -20,17 +20,17 @@ pub struct Attacking; impl <'a> System<'a> for Attacking { type SystemData = ( Entities<'a>, - WriteStorage<'a, Attacked>, + WriteStorage<'a, AttackInbox>, WriteStorage<'a, Health>, WriteStorage<'a, Dying>, WriteStorage<'a, Removed>, ReadStorage<'a, Position>, Write<'a, NewEntities> ); - fn run(&mut self, (entities, mut victims, mut healths, mut deads, mut removals, positions, mut new): Self::SystemData) { - for (ent, health, attacked) in (&entities, &mut healths, &mut victims).join() { + fn run(&mut self, (entities, mut attackeds, mut healths, mut deads, mut removals, positions, mut new): Self::SystemData) { + for (ent, health, attacked) in (&entities, &mut healths, &mut attackeds).join() { let mut wounded = false; - for attack in attacked.attacks.drain(..) { + for attack in attacked.messages.drain(..) { health.health -= attack.damage; if attack.damage > 0 { wounded = true; @@ -47,7 +47,7 @@ impl <'a> System<'a> for Attacking { } } } - victims.clear(); + attackeds.clear(); } } |
