removes deprecated SufferDamage component

This commit is contained in:
Llywelwyn 2023-08-17 05:48:30 +01:00
parent 945242bc42
commit 51f8ee66e6
7 changed files with 20 additions and 39 deletions

View file

@ -1,15 +1,17 @@
use super::{gamelog, HungerClock, HungerState, SufferDamage, LOG_TICKS};
use super::{
effects::{add_effect, EffectType, Targets},
gamelog, HungerClock, HungerState, LOG_TICKS,
};
use specs::prelude::*;
pub struct HungerSystem {}
impl<'a> System<'a> for HungerSystem {
#[allow(clippy::type_complexity)]
type SystemData =
(Entities<'a>, WriteStorage<'a, HungerClock>, ReadExpect<'a, Entity>, WriteStorage<'a, SufferDamage>);
type SystemData = (Entities<'a>, WriteStorage<'a, HungerClock>, ReadExpect<'a, Entity>);
fn run(&mut self, data: Self::SystemData) {
let (entities, mut hunger_clock, player_entity, mut inflict_damage) = data;
let (entities, mut hunger_clock, player_entity) = data;
for (entity, mut clock) in (&entities, &mut hunger_clock).join() {
if LOG_TICKS && entity == *player_entity {
@ -32,14 +34,14 @@ impl<'a> System<'a> for HungerSystem {
clock.state = HungerState::Hungry;
clock.duration = 400;
if entity == *player_entity {
gamelog::Logger::new().colour(rltk::RED).append("You feel hungry.").log();
gamelog::Logger::new().colour(rltk::BROWN1).append("You feel hungry.").log();
}
}
HungerState::Hungry => {
clock.state = HungerState::Weak;
clock.duration = 200;
if entity == *player_entity {
gamelog::Logger::new().colour(rltk::RED).append("You feel weak with hunger.").log();
gamelog::Logger::new().colour(rltk::ORANGE).append("You feel weak with hunger.").log();
}
}
HungerState::Weak => {
@ -50,7 +52,7 @@ impl<'a> System<'a> for HungerSystem {
}
}
HungerState::Fainting => {
SufferDamage::new_damage(&mut inflict_damage, entity, 1, false);
add_effect(None, EffectType::Damage { amount: 1 }, Targets::Entity { target: entity });
if entity == *player_entity {
gamelog::Logger::new().colour(rltk::RED).append("You can't go on without food...").log();
}