Remove atmos device dependency on game timer (#18847)
This commit is contained in:
@@ -12,7 +12,6 @@ using Content.Shared.CCVar;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.EntitySystems;
|
namespace Content.Server.Atmos.EntitySystems;
|
||||||
|
|
||||||
@@ -21,7 +20,6 @@ public sealed class HeatExchangerSystem : EntitySystem
|
|||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||||
[Dependency] private IGameTiming _gameTiming = default!;
|
|
||||||
|
|
||||||
float tileLoss;
|
float tileLoss;
|
||||||
|
|
||||||
@@ -56,7 +54,7 @@ public sealed class HeatExchangerSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Positive dN flows from inlet to outlet
|
// Positive dN flows from inlet to outlet
|
||||||
var dt = (float)(_gameTiming.CurTime - device.LastProcess).TotalSeconds;
|
var dt = args.dt;
|
||||||
var dP = inlet.Air.Pressure - outlet.Air.Pressure;
|
var dP = inlet.Air.Pressure - outlet.Air.Pressure;
|
||||||
|
|
||||||
// What we want is dN/dt = G*dP (first-order constant-coefficient differential equation w.r.t. P).
|
// What we want is dN/dt = G*dP (first-order constant-coefficient differential equation w.r.t. P).
|
||||||
|
|||||||
@@ -19,14 +19,12 @@ using Content.Shared.Interaction;
|
|||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasVolumePumpSystem : EntitySystem
|
public sealed class GasVolumePumpSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
@@ -94,7 +92,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
||||||
var removed = inlet.Air.RemoveVolume((float)(pump.TransferRate * (_gameTiming.CurTime - device.LastProcess).TotalSeconds));
|
var removed = inlet.Air.RemoveVolume((float)(pump.TransferRate * args.dt));
|
||||||
|
|
||||||
// Some of the gas from the mixture leaks when overclocked.
|
// Some of the gas from the mixture leaks when overclocked.
|
||||||
if (pump.Overclocked)
|
if (pump.Overclocked)
|
||||||
|
|||||||
@@ -15,14 +15,12 @@ using Content.Shared.Popups;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasFilterSystem : EntitySystem
|
public sealed class GasFilterSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private UserInterfaceSystem _userInterfaceSystem = default!;
|
[Dependency] private UserInterfaceSystem _userInterfaceSystem = default!;
|
||||||
[Dependency] private IAdminLogManager _adminLogger = default!;
|
[Dependency] private IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
@@ -67,7 +65,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
||||||
var transferVol = (float)(filter.TransferRate * (_gameTiming.CurTime - device.LastProcess).TotalSeconds);
|
var transferVol = (float)(filter.TransferRate * args.dt);
|
||||||
|
|
||||||
if (transferVol <= 0)
|
if (transferVol <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,14 +8,12 @@ using Content.Shared.Atmos.Piping;
|
|||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class PressureControlledValveSystem : EntitySystem
|
public sealed class PressureControlledValveSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
@@ -70,7 +68,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
|||||||
UpdateAppearance(uid, comp);
|
UpdateAppearance(uid, comp);
|
||||||
|
|
||||||
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
||||||
var transferVolume = (float)(transferRate * (_gameTiming.CurTime - device.LastProcess).TotalSeconds);
|
var transferVolume = (float)(transferRate * args.dt);
|
||||||
if (transferVolume <= 0)
|
if (transferVolume <= 0)
|
||||||
{
|
{
|
||||||
_ambientSoundSystem.SetAmbience(comp.Owner, false);
|
_ambientSoundSystem.SetAmbience(comp.Owner, false);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using Content.Shared.Atmos.Piping;
|
|||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -16,7 +15,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
public sealed class GasOutletInjectorSystem : EntitySystem
|
public sealed class GasOutletInjectorSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||||
|
|
||||||
@@ -73,7 +71,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (environment.Pressure > injector.MaxPressure)
|
if (environment.Pressure > injector.MaxPressure)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var timeDelta = (float) (_gameTiming.CurTime - device.LastProcess).TotalSeconds;
|
var timeDelta = args.dt;
|
||||||
|
|
||||||
// TODO adjust ratio so that environment does not go above MaxPressure?
|
// TODO adjust ratio so that environment does not go above MaxPressure?
|
||||||
var ratio = MathF.Min(1f, timeDelta * injector.TransferRate / inlet.Air.Volume);
|
var ratio = MathF.Min(1f, timeDelta * injector.TransferRate / inlet.Air.Volume);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ using Content.Shared.Audio;
|
|||||||
using Content.Shared.Examine;
|
using Content.Shared.Examine;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -29,7 +28,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!;
|
[Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!;
|
||||||
[Dependency] private readonly DeviceLinkSystem _signalSystem = default!;
|
[Dependency] private readonly DeviceLinkSystem _signalSystem = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||||
@@ -81,7 +79,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeDelta = (_gameTiming.CurTime - device.LastProcess).TotalSeconds;
|
var timeDelta = args.dt;
|
||||||
var pressureDelta = (float) timeDelta * vent.TargetPressureChange;
|
var pressureDelta = (float) timeDelta * vent.TargetPressureChange;
|
||||||
|
|
||||||
if (vent.PumpDirection == VentPumpDirection.Releasing && pipe.Air.Pressure > 0)
|
if (vent.PumpDirection == VentPumpDirection.Releasing && pipe.Air.Pressure > 0)
|
||||||
|
|||||||
@@ -17,14 +17,12 @@ using Content.Shared.Atmos.Piping.Unary.Components;
|
|||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GasVentScrubberSystem : EntitySystem
|
public sealed class GasVentScrubberSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!;
|
[Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!;
|
||||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
|
||||||
@@ -54,7 +52,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
|||||||
if (!TryComp(uid, out AtmosDeviceComponent? device))
|
if (!TryComp(uid, out AtmosDeviceComponent? device))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var timeDelta = (float) (_gameTiming.CurTime - device.LastProcess).TotalSeconds;
|
var timeDelta = args.dt;
|
||||||
|
|
||||||
if (!scrubber.Enabled
|
if (!scrubber.Enabled
|
||||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Content.Server.Atmos.Piping.Components;
|
|||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.NodeContainer;
|
using Content.Server.NodeContainer;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Content.Server.NodeContainer.NodeGroups;
|
using Content.Server.NodeContainer.NodeGroups;
|
||||||
@@ -25,7 +24,6 @@ namespace Content.Server.Atmos.Portable
|
|||||||
[Dependency] private readonly GasCanisterSystem _canisterSystem = default!;
|
[Dependency] private readonly GasCanisterSystem _canisterSystem = default!;
|
||||||
[Dependency] private readonly GasPortableSystem _gasPortableSystem = default!;
|
[Dependency] private readonly GasPortableSystem _gasPortableSystem = default!;
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||||
[Dependency] private readonly AmbientSoundSystem _ambientSound = default!;
|
[Dependency] private readonly AmbientSoundSystem _ambientSound = default!;
|
||||||
@@ -55,7 +53,7 @@ namespace Content.Server.Atmos.Portable
|
|||||||
if (!TryComp(uid, out AtmosDeviceComponent? device))
|
if (!TryComp(uid, out AtmosDeviceComponent? device))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var timeDelta = (float) (_gameTiming.CurTime - device.LastProcess).TotalSeconds;
|
var timeDelta = args.dt;
|
||||||
|
|
||||||
if (!component.Enabled)
|
if (!component.Enabled)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Content.Server.NodeContainer.EntitySystems;
|
|||||||
using Content.Server.NodeContainer.Nodes;
|
using Content.Server.NodeContainer.Nodes;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Shared.Timing;
|
|
||||||
|
|
||||||
namespace Content.Server.Power.Generator;
|
namespace Content.Server.Power.Generator;
|
||||||
|
|
||||||
@@ -14,26 +13,18 @@ namespace Content.Server.Power.Generator;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class GasPowerReceiverSystem : EntitySystem
|
public sealed class GasPowerReceiverSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
|
||||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||||
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
[Dependency] private readonly NodeContainerSystem _nodeContainer = default!;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<GasPowerReceiverComponent, MapInitEvent>(OnMapInit);
|
|
||||||
SubscribeLocalEvent<GasPowerReceiverComponent, AtmosDeviceUpdateEvent>(OnDeviceUpdated);
|
SubscribeLocalEvent<GasPowerReceiverComponent, AtmosDeviceUpdateEvent>(OnDeviceUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMapInit(EntityUid uid, GasPowerReceiverComponent component, MapInitEvent args)
|
|
||||||
{
|
|
||||||
component.LastProcess = _gameTiming.CurTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDeviceUpdated(EntityUid uid, GasPowerReceiverComponent component, AtmosDeviceUpdateEvent args)
|
private void OnDeviceUpdated(EntityUid uid, GasPowerReceiverComponent component, AtmosDeviceUpdateEvent args)
|
||||||
{
|
{
|
||||||
var timeDelta = (float)(_gameTiming.CurTime - component.LastProcess).TotalSeconds;
|
var timeDelta = args.dt;
|
||||||
component.LastProcess = _gameTiming.CurTime;
|
|
||||||
|
|
||||||
if (!HasComp<AtmosDeviceComponent>(uid)
|
if (!HasComp<AtmosDeviceComponent>(uid)
|
||||||
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|
|| !TryComp<NodeContainerComponent>(uid, out var nodeContainer)
|
||||||
|
|||||||
Reference in New Issue
Block a user