Skip to content

Make the reverse random shuffle button work infinitely #1394

@poco0317

Description

@poco0317

In til death you can hold shift and click the random button to go backwards 1 selection. There is not really any reason it is like that.

Also implement this entirely in rebirth

InvokeCommand = function(self, params)
if selectable(self:GetName()) then
TOOLTIP:Hide()
local scr = SCREENMAN:GetTopScreen()
if not params or params and params.event == "DeviceButton_left mouse button" then
-- full random
local group = WHEELDATA:GetRandomFolder()
local song = WHEELDATA:GetRandomSongInFolder(group)
scr:GetChild("WheelFile"):playcommand("FindSong", {song = song})
else
if openedGroup ~= nil and #openedGroup > 0 then
-- random song in group
local song = WHEELDATA:GetRandomSongInFolder(openedGroup)
scr:GetChild("WheelFile"):playcommand("FindSong", {song = song, group = openedGroup})
else
-- when not in any group, get a random group
local group = WHEELDATA:GetRandomFolder()
scr:GetChild("WheelFile"):playcommand("FindGroup", {group = group})
end
end
end
end,

MouseDownCommand = function(self, params)
if not visible then return end
if params.event == "DeviceButton_left mouse button" then
if not self:GetParent():GetChild("GroupPage"):IsInvisible() then
-- left clicking the group header gives a random song in the group
local song = WHEELDATA:GetRandomSongInFolder(openedGroup)
self:GetParent():GetParent():GetChild("WheelContainer"):playcommand("FindSong", {song = song, group = openedGroup})
elseif not self:GetParent():GetChild("MiscPage"):IsInvisible() then
-- left clicking the normal header gives a random group (???)
local group = WHEELDATA:GetRandomFolder()
self:GetParent():GetParent():GetChild("WheelContainer"):playcommand("FindGroup", {group = group})
end
end
end,

MouseDownCommand = function(self, params)
if params.event == "DeviceButton_left mouse button" then
local w = SCREENMAN:GetTopScreen():GetMusicWheel()
if INPUTFILTER:IsShiftPressed() and self.lastlastrandom ~= nil then
-- if the last random song wasnt filtered out, we can select it
-- so end early after jumping to it
if w:SelectSong(self.lastlastrandom) then
return
end
-- otherwise, just pick a new random song
end
local t = w:GetSongs()
if #t == 0 then return end
local random_song = t[math.random(#t)]
w:SelectSong(random_song)
self.lastlastrandom = self.lastrandom
self.lastrandom = random_song
end
end

MouseDownCommand = function(self, params)
if group_rand ~= "" and params.event == "DeviceButton_left mouse button" then
local w = SCREENMAN:GetTopScreen():GetMusicWheel()
if INPUTFILTER:IsShiftPressed() and self.lastlastrandom ~= nil then
-- if the last random song wasnt filtered out, we can select it
-- so end early after jumping to it
if w:SelectSong(self.lastlastrandom) then
return
end
-- otherwise, just pick a new random song
end
local t = w:GetSongsInGroup(group_rand)
if #t == 0 then return end
local random_song = t[math.random(#t)]
w:SelectSong(random_song)
self.lastlastrandom = self.lastrandom
self.lastrandom = random_song
end
end,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions