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)
return;
component.CurrentThreshold = calculatedHungerThreshold;
+ DirtyField(uid, component, nameof(HungerComponent.CurrentThreshold));
DoHungerThresholdEffects(uid, component);
}
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)
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);
// 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);
}
component.ThirstThresholds[ThirstThreshold.OverHydrated]
);
- EntityManager.DirtyField(uid, component, nameof(ThirstComponent.CurrentThirst));
+ DirtyField(uid, component, nameof(ThirstComponent.CurrentThirst));
}
private bool IsMovementThreshold(ThirstThreshold threshold)
_alerts.ClearAlertCategory(uid, component.ThirstyCategory);
}
+ DirtyField(uid, component, nameof(ThirstComponent.LastThirstThreshold));
+ DirtyField(uid, component, nameof(ThirstComponent.ActualDecayRate));
+
switch (component.CurrentThirstThreshold)
{
case ThirstThreshold.OverHydrated: