diff --git a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs index f7a6855abc..d5f8860081 100644 --- a/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/HungerSystem.cs @@ -156,11 +156,6 @@ public sealed class HungerSystem : EntitySystem _alerts.ClearAlertCategory(uid, AlertCategory.Hunger); } - if (component.StarvationDamage is { } damage && !_mobState.IsDead(uid)) - { - _damageable.TryChangeDamage(uid, damage, true, false); - } - if (component.HungerThresholdDecayModifiers.TryGetValue(component.CurrentThreshold, out var modifier)) { component.ActualDecayRate = component.BaseDecayRate * modifier; @@ -169,6 +164,19 @@ public sealed class HungerSystem : EntitySystem component.LastThreshold = component.CurrentThreshold; } + private void DoContinuousHungerEffects(EntityUid uid, HungerComponent? component = null) + { + if (!Resolve(uid, ref component)) + return; + + if (component.CurrentThreshold <= HungerThreshold.Starving && + component.StarvationDamage is { } damage && + !_mobState.IsDead(uid)) + { + _damageable.TryChangeDamage(uid, damage, true, false); + } + } + /// /// Gets the hunger threshold for an entity based on the amount of food specified. /// If a specific amount isn't specified, just uses the current hunger of the entity @@ -220,6 +228,7 @@ public sealed class HungerSystem : EntitySystem hunger.NextUpdateTime = _timing.CurTime + hunger.UpdateRate; ModifyHunger(uid, -hunger.ActualDecayRate, hunger); + DoContinuousHungerEffects(uid, hunger); } } }