atomising item use: hunger effect
This commit is contained in:
parent
18eae23a4c
commit
931f600625
13 changed files with 455 additions and 360 deletions
12
src/effects/hunger.rs
Normal file
12
src/effects/hunger.rs
Normal 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;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue