MapAmbienceMute.cs
using Sandbox;
namespace PaintballBaddies;
/// <summary>The Los Hermanos workshop map ships ambient loops (a fan-like hum)
/// that play under the menu and the whole match. Mute the map's own ambient
/// sound components in Last Orders; the game's combat audio is unaffected.</summary>
public sealed class MapAmbienceMute : Component
{
private float scan;
public int Muted {get;private set;}
private static readonly string[] Ambient={"SoundPointComponent","SoundBoxComponent","SoundscapeTrigger","Soundscape"};
protected override void OnUpdate()
{
if(ArenaSelection.Current(Scene)!=ArenaSelection.Restaurant)return;
scan-=Time.Delta;if(scan>0)return;scan=1;
foreach(var c in Scene.GetAllComponents<Component>().Where(c=>c.Enabled && Ambient.Contains(c.GetType().Name)).ToArray())
{
c.Enabled=false;Muted++;
Log.Info($"MAP_AMBIENCE_MUTED {c.GetType().Name} on '{c.GameObject.Name}'");
}
}
}