-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Moved temperature to shared #31249
base: master
Are you sure you want to change the base?
Moved temperature to shared #31249
Conversation
I think this one is a duplicate of #30511 |
crusher dagger disgustingly op |
I totally forgot about that one 😅 |
heater.Comp2.Load = SettingPower(setting, heater.Comp1!.Power); | ||
Appearance.SetData(heater, EntityHeaterVisuals.Setting, setting); |
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.
Sussy null suppression because this can cause nullrefs and isn't guaranteed to exist.
[RegisterComponent, Access(typeof(SharedEntityHeaterSystem))] | ||
public sealed partial class EntityHeaterComponent : Component |
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.
Needs NetworkedComponent also it's being dirtied but there's nothing actually being synced.
[RegisterComponent, Access(typeof(SharedTemperatureSystem))] | ||
public sealed partial class InternalTemperatureComponent : Component |
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.
Needs NetworkedComponent
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] | ||
public float CurrentTemperature = Atmospherics.T20C; | ||
|
||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] |
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.
VVRW unnecessary on datafields.
|
||
private void UpdateDamage(float frameTime) | ||
{ | ||
_accumulatedFrametime += frameTime; | ||
|
||
if (_accumulatedFrametime < UpdateInterval) | ||
return; | ||
_accumulatedFrametime -= UpdateInterval; | ||
|
||
if (!ShouldUpdateDamage.Any()) | ||
return; | ||
|
||
foreach (var comp in ShouldUpdateDamage) | ||
{ | ||
MetaDataComponent? metaData = null; | ||
|
||
var uid = comp.Owner; | ||
if (Deleted(uid, metaData) || Paused(uid, metaData)) | ||
continue; | ||
|
||
ChangeDamage(uid, comp); | ||
} | ||
|
||
ShouldUpdateDamage.Clear(); | ||
} | ||
|
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.
Was going to comment this breaks persistence but it was already like this so.
{ | ||
var temperatureQuery = GetEntityQuery<TemperatureComponent>(); | ||
var transformQuery = GetEntityQuery<TransformComponent>(); | ||
var thresholdsQuery = GetEntityQuery<ContainerTemperatureDamageThresholdsComponent>(); |
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.
Can move these to the system.
RecursiveThresholdUpdate(uid, GetEntityQuery<TemperatureComponent>(), GetEntityQuery<TransformComponent>(), | ||
GetEntityQuery<ContainerTemperatureDamageThresholdsComponent>()); |
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.
Same just use it on the system.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
1 similar comment
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Hey, when will you continue working? Or someone on vacation... Just wondering, nothing more |
are you still working on this? |
About the PR
Moved Temperature component, ThermalRegulator component and most of the implementation of temperature, thermal regulation and heater systems to Content.Shared. This will allow shared content to interact with TemperatureComponent without requiring a ServerSide implementation. This does not implement predicted temperature, it only networks the component states.
Why / Balance
No visible changes for players. This was done to make working with temperature in shared systems easier.
Technical details
Simply moved temperature, thermal regulation and heater systems to shared along with their associated components. I also networked the components to make sure that the data is accessible on the client as well. I did not implement prediction since temperature interacts with atmospherics which is a purely server-side system and would make prediction more difficult. Values on temperature related components are calculated on the server and then networked to the clients.
Media
Requirements
Breaking changes
Namespace changes:
Obsolete methods (will be removed in the future):
Changelog