Disable music auto-play unless tracks are installed.

This commit is contained in:
Paul Chote
2015-08-01 23:05:09 +01:00
parent 9b3ef9e7f7
commit 1d307bfe07
2 changed files with 8 additions and 10 deletions

View File

@@ -63,12 +63,8 @@ namespace OpenRA.Mods.Common.Traits
.Select(a => a.Value)
.ToArray();
IsMusicAvailable = playlist.Any();
random = playlist.Shuffle(Game.CosmeticRandom).ToArray();
// Always start with a random song
currentSong = random.FirstOrDefault();
IsMusicAvailable = playlist.Any();
if (SongExists(info.StartingMusic))
currentSong = world.Map.Rules.Music[info.StartingMusic];
@@ -77,6 +73,13 @@ namespace OpenRA.Mods.Common.Traits
currentSong = currentBackgroundSong = world.Map.Rules.Music[info.BackgroundMusic];
CurrentSongIsBackground = true;
}
else
{
// Start playback with a random song, but only if the player has installed more music
var installData = Game.ModData.Manifest.Get<ContentInstaller>();
if (playlist.Length > installData.ShippedSoundtracks)
currentSong = random.FirstOrDefault();
}
Play();
}