From bb324fb2d4c1408284b265f7a4e42bdb92610ac3 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 11 Apr 2019 21:15:07 +0100 Subject: [PATCH] Add Sound.DisableAllSounds property. --- OpenRA.Game/Sound/Sound.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index d5188fbd99..a4912aa065 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -111,7 +111,7 @@ namespace OpenRA ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false) { - if (string.IsNullOrEmpty(name) || (DisableWorldSounds && type == SoundType.World)) + if (string.IsNullOrEmpty(name) || DisableAllSounds || (DisableWorldSounds && type == SoundType.World)) return null; if (player != null && player != player.World.LocalPlayer) @@ -137,6 +137,7 @@ namespace OpenRA soundEngine.Volume = 1f; } + public bool DisableAllSounds { get; set; } public bool DisableWorldSounds { get; set; } public ISound Play(SoundType type, string name) { return Play(type, null, name, true, WPos.Zero, 1f); } public ISound Play(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f); } @@ -350,7 +351,7 @@ namespace OpenRA if (ruleset == null) throw new ArgumentNullException("ruleset"); - if (definition == null || (DisableWorldSounds && soundType == SoundType.World)) + if (definition == null || DisableAllSounds || (DisableWorldSounds && soundType == SoundType.World)) return false; if (ruleset.Voices == null || ruleset.Notifications == null)