Remove atmos device dependency on game timer (#18847)

This commit is contained in:
Kevin Zheng
2023-08-12 23:42:12 -07:00
committed by GitHub
parent 551de79efa
commit d7fa5b73c3
9 changed files with 9 additions and 34 deletions

View File

@@ -8,14 +8,12 @@ using Content.Shared.Atmos.Piping;
using Content.Shared.Audio;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Timing;
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
{
[UsedImplicitly]
public sealed class PressureControlledValveSystem : EntitySystem
{
[Dependency] private IGameTiming _gameTiming = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
@@ -70,7 +68,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
UpdateAppearance(uid, comp);
// 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)
{
_ambientSoundSystem.SetAmbience(comp.Owner, false);