Standard Lua formatting

This commit is contained in:
WantedDV 2023-04-12 19:09:36 -02:30
parent 70297f04c8
commit 727b4eadeb
5 changed files with 237 additions and 233 deletions

View File

@ -80,13 +80,12 @@ DataSources.ChangeMapCategories = DataSourceHelpers.ListSetup( "ChangeMapCategor
table.insert(f6_local0, f6_local2("dlc_bonus", f0_local3))
end
if Mods_Enabled() then --and Engine.Mods_Lists_GetInfoEntries( LuaEnums.USERMAP_BASE_PATH, 0, Engine.Mods_Lists_GetInfoEntriesCount( LuaEnums.USERMAP_BASE_PATH ) ) ~= nil then
local f9_local11 = Engine.Mods_Lists_GetInfoEntries( LuaEnums.USERMAP_BASE_PATH, 0, Engine.Mods_Lists_GetInfoEntriesCount( LuaEnums.USERMAP_BASE_PATH ) )
local f9_local11 = Engine.Mods_Lists_GetInfoEntries(LuaEnums.USERMAP_BASE_PATH, 0,
Engine.Mods_Lists_GetInfoEntriesCount(LuaEnums.USERMAP_BASE_PATH))
if f9_local11 then
for f9_local12 = 0, #f9_local11, 1 do
local f9_local17 = f9_local11[f9_local12]
if LUI.startswith(f9_local17.internalName, "mp_") then
table.insert(f6_local0, f6_local2("mods", CoD.CONTENT_MODS_INDEX))
end
end
@ -95,4 +94,3 @@ DataSources.ChangeMapCategories = DataSourceHelpers.ListSetup( "ChangeMapCategor
end
return f6_local0
end, true)

View File

@ -46,14 +46,16 @@ local PostLoadFunc = function ( f3_arg0, f3_arg1 )
while f6_local0 and f6_local0.menuName ~= "Lobby" do
f6_local0 = GoBack(f6_local0, f3_arg1)
end
Engine.SendClientScriptNotify( f3_arg1, "menu_change" .. Engine.GetLocalClientNum( f3_arg1 ), "Main", "closeToMenu" )
Engine.SendClientScriptNotify(f3_arg1, "menu_change" .. Engine.GetLocalClientNum(f3_arg1), "Main",
"closeToMenu")
return
end
GoBack(f3_arg0, f3_arg1)
end, false)
end
DataSources.GameSettingsFlyoutButtonsCustom = DataSourceHelpers.ListSetup( "GameSettingsFlyoutButtonsCustom", function ( f7_arg0 )
DataSources.GameSettingsFlyoutButtonsCustom = DataSourceHelpers.ListSetup("GameSettingsFlyoutButtonsCustom",
function(f7_arg0)
local f7_local0 = {
{
optionDisplay = "MPUI_CHANGE_MAP_CAPS",
@ -143,7 +145,8 @@ LUI.createMenu.GameSettingsFlyoutMPCustom = function ( controller )
end
return f10_local0
end)
self:AddButtonCallbackFunction( Options, controller, Enum.LUIButton.LUI_KEY_XBA_PSCROSS, "ENTER", function ( element, menu, controller, model )
self:AddButtonCallbackFunction(Options, controller, Enum.LUIButton.LUI_KEY_XBA_PSCROSS, "ENTER",
function(element, menu, controller, model)
ProcessListAction(self, element, controller)
return true
end, function(element, menu, controller)
@ -181,7 +184,8 @@ LUI.createMenu.GameSettingsFlyoutMPCustom = function ( controller )
}
CoD.Menu.UpdateButtonShownState(f15_local0, self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE)
end)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, nil, function ( element, menu, controller, model )
self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, nil,
function(element, menu, controller, model)
GoBack(self, controller)
ClearMenuSavedState(menu)
return true
@ -189,14 +193,16 @@ LUI.createMenu.GameSettingsFlyoutMPCustom = function ( controller )
CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_XBB_PSCIRCLE, "")
return false
end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_START, "M", function ( element, menu, controller, model )
self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_START, "M",
function(element, menu, controller, model)
GoBackAndOpenOverlayOnParent(self, "StartMenu_Main", controller)
return true
end, function(element, menu, controller)
CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_START, "MENU_MENU")
return true
end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE, "S", function ( element, menu, controller, model )
self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_XBY_PSTRIANGLE, "S",
function(element, menu, controller, model)
if not IsLAN() and not IsPlayerAGuest(controller) and IsPlayerAllowedToPlayOnline(controller) then
GoBackAndOpenOverlayOnParent(self, "Social_Main", controller)
return true
@ -211,14 +217,16 @@ LUI.createMenu.GameSettingsFlyoutMPCustom = function ( controller )
return false
end
end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_LB, nil, function ( element, menu, controller, model )
self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_LB, nil,
function(element, menu, controller, model)
SendButtonPressToOccludedMenu(menu, controller, model, Enum.LUIButton.LUI_KEY_LB)
return true
end, function(element, menu, controller)
CoD.Menu.SetButtonLabel(menu, Enum.LUIButton.LUI_KEY_LB, "")
return false
end, false)
self:AddButtonCallbackFunction( self, controller, Enum.LUIButton.LUI_KEY_RB, nil, function ( element, menu, controller, model )
self:AddButtonCallbackFunction(self, controller, Enum.LUIButton.LUI_KEY_RB, nil,
function(element, menu, controller, model)
SendButtonPressToOccludedMenu(menu, controller, model, Enum.LUIButton.LUI_KEY_RB)
return true
end, function(element, menu, controller)
@ -242,7 +250,8 @@ LUI.createMenu.GameSettingsFlyoutMPCustom = function ( controller )
end
LUI.OverrideFunction_CallOriginalSecond(self, "close", function(element)
element.Options:close()
Engine.UnsubscribeAndFreeModel( Engine.GetModel( Engine.GetModelForController( controller ), "GameSettingsFlyoutMP.buttonPrompts" ) )
Engine.UnsubscribeAndFreeModel(Engine.GetModel(Engine.GetModelForController(controller),
"GameSettingsFlyoutMP.buttonPrompts"))
end)
if PostLoadFunc then
PostLoadFunc(self, controller)

View File

@ -2,8 +2,8 @@ if Engine.GetCurrentMap() ~= "core_frontend" then
return
end
local EnableLobbyMapVote = true -- toggle map vote in public lobby
local EnableLargeServerBrowserButton = true -- toggle large server browser button
local enableLobbyMapVote = true -- toggle map vote in public lobby
local enableLargeServerBrowserButton = true -- toggle large server browser button
local utils = require("utils")
require("DataSources_StartMenuTabs")
@ -77,15 +77,14 @@ CoD.LobbyButtons.SERVER_BROWSER = {
customId = "btnDedicated"
}
local LobbyMapVoteIsEnabled = EnableLobbyMapVote
local LobbyMapVote = function( LobbyMapVoteIsEnabled )
if LobbyMapVoteIsEnabled == true then
local lobbyMapVoteIsEnabled = enableLobbyMapVote
local lobbyMapVote = function(lobbyMapVoteIsEnabled)
if lobbyMapVoteIsEnabled == true then
Engine.Exec(nil, "LobbyStopDemo")
end
end
local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
if menuId == LobbyData.UITargets.UI_MPLOBBYMAIN.id then
utils.RemoveSpaces(buttonTable)
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.THEATER_MP) - 1)
@ -100,11 +99,10 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
end
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id then
LobbyMapVoteIsEnabled = EnableLobbyMapVote
if EnableLargeServerBrowserButton then
lobbyMapVoteIsEnabled = enableLobbyMapVote
if enableLargeServerBrowserButton then
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.SERVER_BROWSER, 1)
end
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then
utils.RemoveButton(buttonTable, CoD.LobbyButtons.MP_PUBLIC_LOBBY_LEADERBOARD)
@ -112,9 +110,8 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP, 2)
utils.AddSpacer(buttonTable, utils.GetButtonIndex(buttonTable, CoD.LobbyButtons.GameSettingsFlyoutMP))
LobbyMapVote( LobbyMapVoteIsEnabled )
LobbyMapVoteIsEnabled = false
lobbyMapVote(lobbyMapVoteIsEnabled)
lobbyMapVoteIsEnabled = false
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEARENAGAME.id then
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1)
utils.AddSmallButton(controller, buttonTable, CoD.LobbyButtons.GameSettingsFlyoutArenas, 2)