Disable sound on the shell maps.
This commit is contained in:
@@ -96,8 +96,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false)
|
ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name) || (DisableWorldSounds && type == SoundType.World))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (player != null && player != player.World.LocalPlayer)
|
if (player != null && player != player.World.LocalPlayer)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -121,6 +122,7 @@ namespace OpenRA
|
|||||||
soundEngine.Volume = 1f;
|
soundEngine.Volume = 1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) { 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); }
|
public ISound Play(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f); }
|
||||||
public ISound Play(SoundType type, string name, float volumeModifier) { return Play(type, null, name, true, WPos.Zero, volumeModifier); }
|
public ISound Play(SoundType type, string name, float volumeModifier) { return Play(type, null, name, true, WPos.Zero, volumeModifier); }
|
||||||
@@ -308,7 +310,7 @@ namespace OpenRA
|
|||||||
if (ruleset == null)
|
if (ruleset == null)
|
||||||
throw new ArgumentNullException("ruleset");
|
throw new ArgumentNullException("ruleset");
|
||||||
|
|
||||||
if (definition == null)
|
if (definition == null || (DisableWorldSounds && soundType == SoundType.World))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (ruleset.Voices == null || ruleset.Notifications == null)
|
if (ruleset.Voices == null || ruleset.Notifications == null)
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
"It cannot be paused, but can be overridden by selecting a new track.")]
|
"It cannot be paused, but can be overridden by selecting a new track.")]
|
||||||
public readonly string BackgroundMusic = null;
|
public readonly string BackgroundMusic = null;
|
||||||
|
|
||||||
|
[Desc("Disable all world sounds (combat etc).")]
|
||||||
|
public readonly bool DisableWorldSounds = false;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new MusicPlaylist(init.World, this); }
|
public object Create(ActorInitializer init) { return new MusicPlaylist(init.World, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +58,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
|
if (info.DisableWorldSounds)
|
||||||
|
Game.Sound.DisableWorldSounds = true;
|
||||||
|
|
||||||
IsMusicInstalled = world.Map.Rules.InstalledMusic.Any();
|
IsMusicInstalled = world.Map.Rules.InstalledMusic.Any();
|
||||||
if (!IsMusicInstalled)
|
if (!IsMusicInstalled)
|
||||||
return;
|
return;
|
||||||
@@ -220,6 +226,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
if (currentSong != null)
|
if (currentSong != null)
|
||||||
Game.Sound.StopMusic();
|
Game.Sound.StopMusic();
|
||||||
|
|
||||||
|
Game.Sound.DisableWorldSounds = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ World:
|
|||||||
Scripts: shellmap.lua
|
Scripts: shellmap.lua
|
||||||
MusicPlaylist:
|
MusicPlaylist:
|
||||||
BackgroundMusic: map1
|
BackgroundMusic: map1
|
||||||
|
DisableWorldSounds: true
|
||||||
|
|
||||||
LST:
|
LST:
|
||||||
Mobile:
|
Mobile:
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ World:
|
|||||||
Maximum: 3
|
Maximum: 3
|
||||||
MusicPlaylist:
|
MusicPlaylist:
|
||||||
BackgroundMusic: options
|
BackgroundMusic: options
|
||||||
|
DisableWorldSounds: true
|
||||||
LuaScript:
|
LuaScript:
|
||||||
Scripts: d2k-shellmap.lua
|
Scripts: d2k-shellmap.lua
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ World:
|
|||||||
-MPStartLocations:
|
-MPStartLocations:
|
||||||
MusicPlaylist:
|
MusicPlaylist:
|
||||||
BackgroundMusic: intro
|
BackgroundMusic: intro
|
||||||
|
DisableWorldSounds: true
|
||||||
ResourceType@ore:
|
ResourceType@ore:
|
||||||
ValuePerUnit: 0
|
ValuePerUnit: 0
|
||||||
LuaScript:
|
LuaScript:
|
||||||
|
|||||||
@@ -1433,6 +1433,7 @@ Rules:
|
|||||||
ValuePerUnit: 0
|
ValuePerUnit: 0
|
||||||
MusicPlaylist:
|
MusicPlaylist:
|
||||||
BackgroundMusic: intro
|
BackgroundMusic: intro
|
||||||
|
DisableWorldSounds: true
|
||||||
GlobalLightingPaletteEffect:
|
GlobalLightingPaletteEffect:
|
||||||
Blue: 0.7
|
Blue: 0.7
|
||||||
Ambient: 0.7
|
Ambient: 0.7
|
||||||
|
|||||||
Reference in New Issue
Block a user