diff options
| author | troido <troido@protonmail.com> | 2020-04-12 23:10:10 +0200 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-04-12 23:10:10 +0200 |
| commit | cfd462a26b3ed4c5f23760a77ae87ce61dc9bbe2 (patch) | |
| tree | c5118158196ec9924ba1123f6279cfe88dbca6e5 /src/systems/attacking.rs | |
| parent | 883e56e07a48dc0d4916614abc33e40dde1d1d66 (diff) | |
replaced Dead component with trigger messages
Diffstat (limited to 'src/systems/attacking.rs')
| -rw-r--r-- | src/systems/attacking.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/systems/attacking.rs b/src/systems/attacking.rs index 804fac1..a202878 100644 --- a/src/systems/attacking.rs +++ b/src/systems/attacking.rs @@ -15,7 +15,8 @@ use crate::{ Health, AttackInbox, AttackType, - Dead, + Trigger, + TriggerBox, Position, Autofight, Ear, @@ -34,14 +35,14 @@ impl <'a> System<'a> for Attacking { Entities<'a>, WriteStorage<'a, AttackInbox>, WriteStorage<'a, Health>, - WriteStorage<'a, Dead>, + WriteStorage<'a, TriggerBox>, ReadStorage<'a, Position>, Write<'a, NewEntities>, WriteStorage<'a, Autofight>, WriteStorage<'a, Ear>, ReadStorage<'a, Visible> ); - fn run(&mut self, (entities, mut attackeds, mut healths, mut deads, positions, mut new, mut autofighters, mut ears, visibles): Self::SystemData) { + fn run(&mut self, (entities, mut attackeds, mut healths, mut triggerboxes, positions, mut new, mut autofighters, mut ears, visibles): Self::SystemData) { for (entity, attacked, autofighter) in (&entities, &attackeds, &mut autofighters).join() { for attack in &attacked.messages { @@ -83,7 +84,7 @@ impl <'a> System<'a> for Attacking { } health.health = util::clamp(health.health, 0, health.maxhealth); if health.health == 0 { - deads.insert(target, Dead).unwrap(); + TriggerBox::add_message(&mut triggerboxes, target, Trigger::Die); let killers = attacker_names.join(" and "); say(&mut ears, target, Notification::Die{actor: killers.clone(), target: target_name.clone()}); for actor in attackers { |
