Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docked music not playing #5378

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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