Fix hunger + thirst mispredicts (#36549)
* Fix hunger + thirst mispredicts * Review
This commit is contained in:
@@ -49,6 +49,8 @@ public sealed class ThirstSystem : EntitySystem
|
||||
component.CurrentThirst = _random.Next(
|
||||
(int) component.ThirstThresholds[ThirstThreshold.Thirsty] + 10,
|
||||
(int) component.ThirstThresholds[ThirstThreshold.Okay] - 1);
|
||||
|
||||
DirtyField(uid, component, nameof(ThirstComponent.CurrentThirst));
|
||||
}
|
||||
component.NextUpdateTime = _timing.CurTime;
|
||||
component.CurrentThirstThreshold = GetThirstThreshold(component, component.CurrentThirst);
|
||||
@@ -56,6 +58,8 @@ public sealed class ThirstSystem : EntitySystem
|
||||
// TODO: Check all thresholds make sense and throw if they don't.
|
||||
UpdateEffects(uid, component);
|
||||
|
||||
DirtyFields(uid, component, null, nameof(ThirstComponent.NextUpdateTime), nameof(ThirstComponent.CurrentThirstThreshold), nameof(ThirstComponent.LastThirstThreshold));
|
||||
|
||||
TryComp(uid, out MovementSpeedModifierComponent? moveMod);
|
||||
_movement.RefreshMovementSpeedModifiers(uid, moveMod);
|
||||
}
|
||||
@@ -103,7 +107,7 @@ public sealed class ThirstSystem : EntitySystem
|
||||
component.ThirstThresholds[ThirstThreshold.OverHydrated]
|
||||
);
|
||||
|
||||
EntityManager.DirtyField(uid, component, nameof(ThirstComponent.CurrentThirst));
|
||||
DirtyField(uid, component, nameof(ThirstComponent.CurrentThirst));
|
||||
}
|
||||
|
||||
private bool IsMovementThreshold(ThirstThreshold threshold)
|
||||
@@ -164,6 +168,9 @@ public sealed class ThirstSystem : EntitySystem
|
||||
_alerts.ClearAlertCategory(uid, component.ThirstyCategory);
|
||||
}
|
||||
|
||||
DirtyField(uid, component, nameof(ThirstComponent.LastThirstThreshold));
|
||||
DirtyField(uid, component, nameof(ThirstComponent.ActualDecayRate));
|
||||
|
||||
switch (component.CurrentThirstThreshold)
|
||||
{
|
||||
case ThirstThreshold.OverHydrated:
|
||||
|
||||
Reference in New Issue
Block a user