Small clean up (#771)

Co-authored-by: Edo <edoardo.sanguineti222@gmail.com>
This commit is contained in:
efinst0rm 2022-11-10 04:41:53 -06:00 committed by GitHub
parent 6f867f52c2
commit 1e2254f58b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,12 +14,12 @@ package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
f14_local1 = GameX.UsesFakeLoadout()
end
local f14_local2 = checkTeamChoice( f14_local0 )
local f14_local2 = LUI.mp_hud.OptionsMenu.checkTeamChoice( f14_local0 )
local f14_local3 = GameX.IsRankedMatch()
local f14_local4 = Engine.GetDvarBool( "splitscreen_ingame" )
local f14_local5 = Game.GetOmnvar( "ui_team_selected" )
local f14_local6 = Game.GetOmnvar( "ui_loadout_selected" )
local f14_local7 = chooseClassCheck( f14_local3, f14_local5, f14_local2 )
local f14_local7 = LUI.mp_hud.OptionsMenu.chooseClassCheck( f14_local3, f14_local5, f14_local2 )
local self = LUI.UIVerticalList.new()
self.id = "pause_selections_Id"
@ -45,7 +45,7 @@ package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
properties = {
childNum = 1,
button_text = Engine.Localize( "@LUA_MENU_CHOOSE_CLASS_CAPS" ),
button_action_func = chooseClassButtonAction
button_action_func = LUI.mp_hud.OptionsMenu.chooseClassButtonAction
}
})
end
@ -57,7 +57,7 @@ package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
properties = {
childNum = 2,
button_text = Engine.Localize( "@LUA_MENU_CHANGE_TEAM_CAPS" ),
button_action_func = changeTeamButtonAction
button_action_func = LUI.mp_hud.OptionsMenu.changeTeamButtonAction
}
})
end
@ -65,14 +65,14 @@ package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
LUI.MenuBuilder.BuildAddChild(self, {
type = "UIGenericButton",
id = "btn_MPPause_2",
disabledFunc = optionsLockedUpdate,
disabledFunc = LUI.mp_hud.OptionsMenu.optionsLockedUpdate,
properties = {
childNum = 3,
button_text = Engine.Localize( "@LUA_MENU_OPTIONS_CAPS" ),
button_action_func = optionsButtonAction
button_action_func = LUI.mp_hud.OptionsMenu.optionsButtonAction
},
handlers = {
refresh_options_button = refreshOptionDisable
refresh_options_button = LUI.mp_hud.OptionsMenu.refreshOptionDisable
}
})
@ -83,7 +83,7 @@ package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
properties = {
childNum = 4,
button_text = Engine.Localize( "@LUA_MENU_MUTE_PLAYERS_CAPS" ),
button_action_func = mutePlayersButtonAction
button_action_func = LUI.mp_hud.OptionsMenu.mutePlayersButtonAction
}
})
end
@ -94,85 +94,8 @@ package.loaded["LUI.mp_hud.OptionsMenu"].options_def = function()
properties = {
childNum = 6,
button_text = Engine.Localize( "@LUA_MENU_END_GAME_CAPS" ),
button_action_func = endGameButtonAction
button_action_func = LUI.mp_hud.OptionsMenu.endGameButtonAction
}
})
return self
end
function refreshOptionDisable( f13_arg0, f13_arg1 )
if not f13_arg0.disabled then
f13_arg0:processEvent({
name = "disable"
})
elseif f13_arg0.disabled then
f13_arg0:processEvent({
name = "enable"
})
end
end
function endGameButtonAction( f8_arg0, f8_arg1 )
local f8_local0 = Engine.GetDvarBool( "isMatchMakingGame" )
local f8_local1 = Engine.GetDvarBool( "sv_running" )
if f8_local0 then
LUI.FlowManager.RequestPopupMenu( f8_arg0, "popup_leave_game", true, f8_arg1.controller )
else
LUI.FlowManager.RequestPopupMenu( f8_arg0, "popup_end_game", true, f8_arg1.controller )
end
end
function checkTeamChoice( f9_arg0 )
if Engine.IsSquadVsSquadMode() then
return false
else
return Engine.TableLookup( GameTypesTable.File, GameTypesTable.Cols.Ref, f9_arg0, GameTypesTable.Cols.TeamChoice ) == "1"
end
end
function chooseClassCheck( f10_arg0, f10_arg1, f10_arg2 )
local f10_local0 = Game.GetPlayerTeam()
if GameX.UsesFakeLoadout() then
return true
elseif f10_arg0 == true then
return true
elseif f10_arg0 == false then
if f10_arg2 == true and (f10_local0 == Teams.allies or f10_local0 == Teams.axis) then
return true
elseif f10_arg2 == false then
return true
end
end
return false
end
function chooseClassButtonAction( f2_arg0, f2_arg1 )
LUI.FlowManager.RequestAddMenu( f2_arg0, "class_select_main", true, f2_arg1.controller )
end
function changeTeamButtonAction( f5_arg0, f5_arg1 )
LUI.FlowManager.RequestAddMenu( f5_arg0, "team_select_main", true, f5_arg1.controller )
end
function mutePlayersButtonAction( f6_arg0, f6_arg1 )
LUI.FlowManager.RequestAddMenu( f6_arg0, "popup_mute_players", true, f6_arg1.controller )
end
function optionsButtonAction( f7_arg0, f7_arg1 )
if Engine.IsConsoleGame() then
LUI.FlowManager.RequestAddMenu( f7_arg0, "mp_in_game_controls_menu", true, f7_arg1.controller )
if GameX.IsSplitscreen() then
GameX.SetOptionState( true )
f7_arg0:dispatchEventToAllOtherRoots({
name = "refresh_options_button",
immediate = true
})
end
else
LUI.FlowManager.RequestAddMenu( f7_arg0, "pc_controls", true, f7_arg1.controller )
end
end
function optionsLockedUpdate( f12_arg0, f12_arg1 )
return GameX.IsOptionStateLocked()
end