diff --git a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs index 89a9132b68..af4af52c41 100644 --- a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs +++ b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs @@ -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(); + if (playlist.Length > installData.ShippedSoundtracks) + currentSong = random.FirstOrDefault(); + } Play(); } diff --git a/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs index 33a57ef3e7..52e42b04de 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MusicPlayerLogic.cs @@ -125,16 +125,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic var music = musicPlaylist.AvailablePlaylist(); currentSong = musicPlaylist.CurrentSong(); - if (currentSong == null && music.Any()) - currentSong = musicPlaylist.GetNextSong(); musicList.RemoveChildren(); foreach (var s in music) { var song = s; - if (currentSong == null) - currentSong = song; - var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }, () => { }); item.Get("TITLE").GetText = () => song.Title; item.Get("LENGTH").GetText = () => SongLengthLabel(song);