summaryrefslogtreecommitdiff
path: root/src/systems/interact.rs
diff options
context:
space:
mode:
authortroido <troido@protonmail.com>2020-04-12 23:10:10 +0200
committertroido <troido@protonmail.com>2020-04-12 23:10:10 +0200
commitcfd462a26b3ed4c5f23760a77ae87ce61dc9bbe2 (patch)
treec5118158196ec9924ba1123f6279cfe88dbca6e5 /src/systems/interact.rs
parent883e56e07a48dc0d4916614abc33e40dde1d1d66 (diff)
replaced Dead component with trigger messages
Diffstat (limited to 'src/systems/interact.rs')
-rw-r--r--src/systems/interact.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/systems/interact.rs b/src/systems/interact.rs
index 73f9023..2c6ee91 100644
--- a/src/systems/interact.rs
+++ b/src/systems/interact.rs
@@ -16,7 +16,8 @@ use crate::{
Position,
ControlCooldown,
Interactable,
- Dead,
+ Trigger,
+ TriggerBox,
Notification,
Ear,
Inventory,
@@ -35,14 +36,14 @@ impl <'a> System<'a> for Interact {
Read<'a, Ground>,
WriteStorage<'a, ControlCooldown>,
ReadStorage<'a, Interactable>,
- WriteStorage<'a, Dead>,
+ WriteStorage<'a, TriggerBox>,
Write<'a, NewEntities>,
WriteStorage<'a, Ear>,
WriteStorage<'a, Inventory>,
ReadStorage<'a, Visible>
);
- fn run(&mut self, (entities, controllers, positions, ground, mut cooldowns, interactables, mut deads, new, mut ears, mut inventories, visibles): Self::SystemData) {
+ fn run(&mut self, (entities, controllers, positions, ground, mut cooldowns, interactables, mut triggerbox, new, mut ears, mut inventories, visibles): Self::SystemData) {
for (entity, controller, position) in (&entities, &controllers, &positions).join(){
let mut target = None;
let ear = ears.get_mut(entity);
@@ -66,7 +67,7 @@ impl <'a> System<'a> for Interact {
let name = visibles.get(ent).map(|v| v.name.as_str());
match interactable {
Interactable::Harvest => {
- deads.insert(ent, Dead).unwrap();
+ TriggerBox::add_message(&mut triggerbox, ent, Trigger::Die);
}
Interactable::Say(text) => {
say(ear, text.clone(), name);