From cfd462a26b3ed4c5f23760a77ae87ce61dc9bbe2 Mon Sep 17 00:00:00 2001 From: troido Date: Sun, 12 Apr 2020 23:10:10 +0200 Subject: replaced Dead component with trigger messages --- src/systems/attacking.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/systems/attacking.rs') 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 { -- cgit