Only accumulate ambience cd when in a new tick (#5623)

This commit is contained in:
metalgearsloth 2021-12-01 00:29:15 +11:00 • committed by GitHub
parent e3b057973d
commit 8e084eea28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Timing;
namespace Content.Client.Audio
{
@ -19,6 +20,7 @@ namespace Content.Client.Audio
public sealed class AmbientSoundSystem : SharedAmbientSoundSystem
{
[Dependency] private IEntityLookup _lookup = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
@ -75,6 +77,8 @@ namespace Content.Client.Audio
{
base.Update(frameTime);
if (!_gameTiming.IsFirstTimePredicted) return;
if (_cooldown <= 0f)
{
_accumulator = 0f;