atomising item use: hunger effect

This commit is contained in:
Llywelwyn 2023-08-17 01:16:35 +01:00
parent 18eae23a4c
commit 931f600625
13 changed files with 455 additions and 360 deletions

12
src/effects/hunger.rs Normal file
View file

@ -0,0 +1,12 @@
use super::EffectSpawner;
use crate::{HungerClock, HungerState};
use specs::prelude::*;
const SATIATED_DURATION: i32 = 200;
pub fn restore_food(ecs: &mut World, _damage: &EffectSpawner, target: Entity) {
if let Some(hc) = ecs.write_storage::<HungerClock>().get_mut(target) {
hc.state = HungerState::Satiated;
hc.duration = SATIATED_DURATION;
}
}