Fix hunger + thirst mispredicts (#36549)
* Fix hunger + thirst mispredicts * Review
This commit is contained in:
@@ -123,6 +123,7 @@ public sealed class HungerSystem : EntitySystem
|
||||
entity.Comp.LastAuthoritativeHungerChangeTime = _timing.CurTime;
|
||||
entity.Comp.LastAuthoritativeHungerValue = ClampHungerWithinThresholds(entity.Comp, value);
|
||||
DirtyField(entity.Owner, entity.Comp, nameof(HungerComponent.LastAuthoritativeHungerChangeTime));
|
||||
DirtyField(entity.Owner, entity.Comp, nameof(HungerComponent.LastAuthoritativeHungerValue));
|
||||
}
|
||||
|
||||
private void UpdateCurrentThreshold(EntityUid uid, HungerComponent? component = null)
|
||||
@@ -135,6 +136,7 @@ public sealed class HungerSystem : EntitySystem
|
||||
return;
|
||||
|
||||
component.CurrentThreshold = calculatedHungerThreshold;
|
||||
DirtyField(uid, component, nameof(HungerComponent.CurrentThreshold));
|
||||
DoHungerThresholdEffects(uid, component);
|
||||
}
|
||||
|
||||
@@ -163,10 +165,12 @@ public sealed class HungerSystem : EntitySystem
|
||||
if (component.HungerThresholdDecayModifiers.TryGetValue(component.CurrentThreshold, out var modifier))
|
||||
{
|
||||
component.ActualDecayRate = component.BaseDecayRate * modifier;
|
||||
DirtyField(uid, component, nameof(HungerComponent.ActualDecayRate));
|
||||
SetAuthoritativeHungerValue((uid, component), GetHunger(component));
|
||||
}
|
||||
|
||||
component.LastThreshold = component.CurrentThreshold;
|
||||
DirtyField(uid, component, nameof(HungerComponent.LastThreshold));
|
||||
}
|
||||
|
||||
private void DoContinuousHungerEffects(EntityUid uid, HungerComponent? component = null)
|
||||
|
||||
Reference in New Issue
Block a user