-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce network burden of thirst system #33403
Conversation
thanks, Rider
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
/// This value should be updated relatively infrequently. To get the current thirst, which changes with each update, | ||
/// use <see cref="ThirstSystem.GetThirst"/>. | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadOnly)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare attributes on the same line, remove ViewVariables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, ViewVariables
is necessary because it explicitly prevents this field from being edited.
# Conflicts: # Content.Shared/Nutrition/EntitySystems/ThirstSystem.cs
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Closing in favor of #34166 |
About the PR
Replace
ThirstComponent
'sCurrentThirst
withThirstSystem.GetThirst
, which calculates the current thirst value from an initial value, a time when that initial value was set, and a constant decay rate.See also #32986
Why / Balance
#28070
Technical details
ThirstComponent
no longer hasCurrentThirst
, and instead hasLastAuthoritativeThirstValue
andLastAuthoritativeThirstChangeTime
ThirstComponent.CurrentThirst
withThirstSystem.GetThirst
, which calculates the current thirst value by predicting the decay since the last authoritative update:LastAuthoritativeThirstValue - (IGameTiming.CurrTime - LastAuthoritativeThirstChangeTime) * ActualDecayRate
ThirstSystem.Update
now only looks to update the current thirst threshold (because there's no value to update)ThirstSystem.SetAuthoritativeThirstValue
, which setsLastAuthoritativeThirstValue
andLastAuthoritativeThirstChangeTime
and dirties the component, causing those values to get pushed to the client, resetting the "current" calculation's basepoint.ThirstSystem.SetThirst
and anything that modifies the current threshold callThirstSystem.SetAuthoritativeThirstValue
to ensure any unpredictable changes are replicated to the client.Media
(With non-game-logic-altering modifications made to raise an event on
ThirstComponent
replication + popup creation when getting that event)thirst.mp4
Requirements
Breaking changes
ThirstComponent
'sCurrentThirst
is gone. It needs to be replaced by:ThirstSystem.GetThirst
in C#lastAuthoritativeThirstValue
in YAML (eg. for initial thirst values on prototypes)Changelog
Technical implementation changes, no CL.