Prune most yml ambientsound entries (#8573)
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Configuration;
|
||||
@@ -29,8 +30,9 @@ namespace Content.Client.Audio
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
private AmbientSoundOverlay? _overlay;
|
||||
private int _maxAmbientCount;
|
||||
|
||||
private bool _overlayEnabled;
|
||||
private float _maxAmbientRange;
|
||||
private float _cooldown;
|
||||
private float _accumulator;
|
||||
@@ -45,7 +47,37 @@ namespace Content.Client.Audio
|
||||
|
||||
private const float RangeBuffer = 3f;
|
||||
|
||||
public bool OverlayEnabled
|
||||
{
|
||||
get => _overlayEnabled;
|
||||
set
|
||||
{
|
||||
if (_overlayEnabled == value) return;
|
||||
_overlayEnabled = value;
|
||||
var overlayManager = IoCManager.Resolve<IOverlayManager>();
|
||||
|
||||
if (_overlayEnabled)
|
||||
{
|
||||
_overlay = new AmbientSoundOverlay(EntityManager, this, Get<EntityLookupSystem>());
|
||||
overlayManager.AddOverlay(_overlay);
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayManager.RemoveOverlay(_overlay!);
|
||||
_overlay = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is this AmbientSound actively playing right now?
|
||||
/// </summary>
|
||||
/// <param name="component"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsActive(AmbientSoundComponent component)
|
||||
{
|
||||
return _playingSounds.ContainsKey(component);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user