Skip to content

Commit

Permalink
Nothing to see here
Browse files Browse the repository at this point in the history
  • Loading branch information
Damgam committed Mar 15, 2024
1 parent 97e68ae commit 1546f0d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Binary file not shown.
21 changes: 18 additions & 3 deletions LuaMenu/widgets/snd_music_lite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,19 @@ local playedTracks = {}
local introTracksIndex = 0
local peaceTracksIndex = 0

local eventType = "none"
local eventTrackPlayed = false

local easterEggCountdown = Spring.GetConfigInt('ChobbyLaunchesCount', 0) + 1 -- Don't play easter egg intro song for first few launches to not make weird first impression
Spring.SetConfigInt('ChobbyLaunchesCount', easterEggCountdown)

local function GetRandomTrack(previousTrack)
-- randomTrackList
-- introTrackList
-- peaceTrackList
local nextTrack
local trackType
for i = 1, #randomTrackList do

if previousTrackType == "intro" or (not introTrackList[1]) then -- we're checking if there are any intro tracks
trackType = "peace"
peaceTracksIndex = peaceTracksIndex + 1
Expand Down Expand Up @@ -188,6 +193,7 @@ function widget:Initialize()
Spring.Echo("RANDOMSEED", math.ceil(os.clock()*1000000))

randomTrackList = {}
aprilFoolsTrackList = {}
local originalSoundtrackEnabled = Spring.GetConfigInt('UseSoundtrackNew', 1)
local customSoundtrackEnabled = Spring.GetConfigInt('UseSoundtrackCustom', 1)
local allowedExtensions = "{*.ogg,*.mp3}"
Expand All @@ -196,6 +202,8 @@ function widget:Initialize()
if originalSoundtrackEnabled == 1 then
local musicDirOriginal = 'luamenu/configs/gameconfig/byar/lobbyMusic/original'
randomTrackList = playlistMerge(randomTrackList, VFS.DirList(musicDirOriginal, allowedExtensions))
local musicDirEventAprilFools = 'luamenu/configs/gameconfig/byar/lobbyMusic/event/aprilfools'
aprilFoolsTrackList = VFS.DirList(musicDirEventAprilFools, allowedExtensions)
end

-- Custom Soundtrack List
Expand Down Expand Up @@ -238,8 +246,15 @@ function widget:Initialize()
end

for i = 1,1000 do
openTrack = introTrackList[1]
introTracksIndex = 1
if (easterEggCountdown > 1 and tonumber(os.date("%m")) == 4 and tonumber(os.date("%d")) <= 3) or (easterEggCountdown > 10 and math.random(0,2137) == 0) then -- April Fools, with a very tiny chance to play the track on normal day
openTrack = aprilFoolsTrackList[math.random(1,#aprilFoolsTrackList)]
end
if openTrack then
break
else
openTrack = introTrackList[1]
introTracksIndex = 1
end
if openTrack then
break
else
Expand Down

0 comments on commit 1546f0d

Please sign in to comment.