Add atmos tick time to atmos device update event (#18781)
This commit is contained in:
@@ -21,6 +21,12 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
public bool ExcitedGroupsSpaceIsAllConsuming { get; private set; }
|
||||
public float AtmosMaxProcessTime { get; private set; }
|
||||
public float AtmosTickRate { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time between each atmos sub-update. If you are writing an atmos device, use AtmosDeviceUpdateEvent.dt
|
||||
/// instead of this value, because atmos devices do not update each are sub-update and sometimes are skipped to
|
||||
/// meet the tick deadline.
|
||||
/// </summary>
|
||||
public float AtmosTime => 1f / AtmosTickRate;
|
||||
|
||||
private void InitializeCVars()
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
private readonly AtmosDeviceUpdateEvent _updateEvent = new();
|
||||
private readonly Stopwatch _simulationStopwatch = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -337,7 +336,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
var number = 0;
|
||||
while (atmosphere.CurrentRunAtmosDevices.TryDequeue(out var device))
|
||||
{
|
||||
RaiseLocalEvent(device.Owner, _updateEvent, false);
|
||||
RaiseLocalEvent(device.Owner, new AtmosDeviceUpdateEvent(AtmosTime * (int)AtmosphereProcessingState.NumStates), false);
|
||||
device.LastProcess = time;
|
||||
|
||||
if (number++ < LagCheckIterations) continue;
|
||||
@@ -509,5 +508,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
Superconductivity,
|
||||
PipeNet,
|
||||
AtmosDevices,
|
||||
NumStates
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user