Add Sound.DisableAllSounds property.

This commit is contained in:
Paul Chote
2019-04-11 21:15:07 +01:00
committed by reaperrr
parent 5d43417a5f
commit bb324fb2d4

View File

@@ -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)