Skip to content

Commit

Permalink
Fix docked music not playing
Browse files Browse the repository at this point in the history
  • Loading branch information
WKFO authored and Webster Sheets committed Jun 13, 2022
1 parent 85ff83f commit 8468b0d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions data/modules/MusicPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,24 @@ end

Event.Register("onGameStart", function ()
MusicPlayer.rebuildSongList()
playAmbient()
if Game.player:GetDockedWith() and music["docked"] then
MusicPlayer.playRandomSongFromCategory("docked")
else
playAmbient()
end
end)

-- if a song finishes fall back to ambient music
-- unless the player is in a map view, in which case
-- we start map music instead
Event.Register("onSongFinished", function ()
if Game.CurrentView() == "sector" or Game.CurrentView() == "system_info" or Game.CurrentView() == "system" then
if Game.player:GetDockedWith() then
if music["docked"] then
MusicPlayer.playRandomSongFromCategory("docked")
else
playAmbient()
end
elseif Game.CurrentView() == "sector" or Game.CurrentView() == "system_info" or Game.CurrentView() == "system" then
if Game.system:DistanceTo(SystemPath.New(0, 0, 0, 0, 0)) < 1000 then -- farther than where ambient music switches
if music["map-core"] then
MusicPlayer.playRandomSongFromCategory("map-core")
Expand Down

0 comments on commit 8468b0d

Please sign in to comment.