Merge pull request #316 from kyzentun/DefaultFailPref
Reinstate DefaultFailType preference
This commit is contained in:
@@ -10,28 +10,6 @@ function AreStageSongModsForced()
|
||||
return GAMESTATE:IsAnExtraStage() or bOni or bBattle or bRave
|
||||
end
|
||||
|
||||
local default_fail_applied= {}
|
||||
|
||||
function ResetDefaultFail()
|
||||
default_fail_applied= {}
|
||||
end
|
||||
|
||||
function SetFail()
|
||||
local sFail = ""
|
||||
if GetGamePref("DefaultFail") then
|
||||
sFail = string.format("FailType_%s", GetGamePref("DefaultFail"))
|
||||
else
|
||||
sFail = "FailType_Off"
|
||||
end
|
||||
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
|
||||
if not default_fail_applied[pn] then
|
||||
GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred"):FailSetting(sFail)
|
||||
default_fail_applied[pn]= true
|
||||
MESSAGEMAN:Broadcast( "PlayerOptionsChanged", {PlayerNumber = pn} )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ScreenSelectMusic:setupmusicstagemods()
|
||||
Trace( "setupmusicstagemods" )
|
||||
local pm = GAMESTATE:GetPlayMode()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
function InitGamePrefs()
|
||||
local Prefs =
|
||||
{
|
||||
{ "DefaultFail", "Immediate" },
|
||||
};
|
||||
|
||||
local BPrefs =
|
||||
@@ -150,82 +149,3 @@ end;
|
||||
--[[ end themeoption rows ]]
|
||||
|
||||
--[[ game option rows ]]
|
||||
local fail_choices= { "Immediate","ImmediateContinue", "EndOfSong", "Off" }
|
||||
function GamePrefDefaultFail()
|
||||
return {
|
||||
Name = "GamePrefDefaultFail";
|
||||
LayoutType = "ShowAllInRow";
|
||||
SelectType = "SelectOne";
|
||||
OneChoiceForAllPlayers = true;
|
||||
ExportOnChange = false;
|
||||
Choices = fail_choices;
|
||||
LoadSelections = function(self, list, pn)
|
||||
if ReadGamePrefFromFile("DefaultFail") ~= nil then
|
||||
local default= GetGamePref("DefaultFail")
|
||||
if default then
|
||||
if default == "Immediate" then
|
||||
list[1] = true
|
||||
elseif default == "ImmediateContinue" then
|
||||
list[2] = true
|
||||
elseif default == "EndOfSong" or default == "AtEnd" then
|
||||
list[3] = true
|
||||
elseif default == "Off" then
|
||||
list[4] = true
|
||||
else
|
||||
list[1] = true
|
||||
end
|
||||
else
|
||||
list[1] = true
|
||||
end
|
||||
else
|
||||
WriteGamePrefToFile("DefaultFail","Immediate")
|
||||
list[1] = true
|
||||
end
|
||||
end;
|
||||
SaveSelections = function(self, list, pn)
|
||||
local val
|
||||
if list[1] then
|
||||
val = fail_choices[1]
|
||||
elseif list[2] then
|
||||
val = fail_choices[2]
|
||||
elseif list[3] then
|
||||
val = fail_choices[3]
|
||||
elseif list[4] then
|
||||
val = fail_choices[4]
|
||||
else
|
||||
val = fail_choices[1]
|
||||
end
|
||||
WriteGamePrefToFile("DefaultFail",val)
|
||||
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } )
|
||||
THEME:ReloadMetrics()
|
||||
end;
|
||||
}
|
||||
end
|
||||
|
||||
function SongPrefFail()
|
||||
-- Apply the default fail type to any players that haven't had it applied.
|
||||
SetFail()
|
||||
return {
|
||||
Name= "Fail",
|
||||
LayoutType= "ShowAllInRow",
|
||||
SelectType= "SelectOne",
|
||||
OneChoiceForAllPlayers= false,
|
||||
ExportOnChange= false,
|
||||
Choices= fail_choices,
|
||||
LoadSelections= function(self, list, pn)
|
||||
local fail= GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred"):FailSetting():sub(10)
|
||||
for i, c in ipairs(self.Choices) do
|
||||
if c == fail then
|
||||
list[i]= true
|
||||
end
|
||||
end
|
||||
end,
|
||||
SaveSelections= function(self, list, pn)
|
||||
for i, c in ipairs(self.Choices) do
|
||||
if list[i] then
|
||||
GAMESTATE:GetPlayerState(pn):GetPlayerOptions("ModsLevel_Preferred"):FailSetting("FailType_" .. c)
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user