atomising item use: placeholder Item triggers

This commit is contained in:
Llywelwyn 2023-08-17 00:43:26 +01:00
parent 55202b241b
commit 18eae23a4c
2 changed files with 25 additions and 0 deletions

16
src/effects/triggers.rs Normal file
View file

@ -0,0 +1,16 @@
use super::{Entity, Targets, World};
use crate::{gamelog, Consumable};
use specs::prelude::*;
pub fn item_trigger(source: Option<Entity>, item: Entity, target: &Targets, ecs: &mut World) {
// Use the item via the generic system
event_trigger(source, item, target, ecs);
// If it's a consumable, delete it
if ecs.read_storage::<Consumable>().get(item).is_some() {
ecs.entities().delete(item).expect("Failed to delete item");
}
}
fn event_trigger(source: Option<Entity>, entity: Entity, target: &Targets, ecs: &mut World) {
let logger = gamelog::Logger::new();
}