Merge pull request #329 from joseupp/lua

Add features in public lobby
This commit is contained in:
Maurice Heumann 2023-03-15 21:36:09 +01:00 committed by GitHub
commit 08564d9166

View File

@ -286,6 +286,30 @@ CoD.LobbyButtons.MP_STATS = {
customId = "btnMPStats"
}
CoD.LobbyButtons.MP_START_GAME = {
stringRef = "MENU_START_GAME_CAPS",
action = function ( self, element, controller, param, menu )
--Engine.SetDvar( "bot_difficulty", 3 )
Engine.SetDvar( "party_minplayers", 1 )
Engine.Exec( nil, "launchgame" )
end,
customId = "btnStartGame"
}
CoD.LobbyButtons.SETTING_UP_BOTS = {
stringRef = "MENU_SETUP_BOTS_CAPS",
action = function ( self, element, controller, param, menu )
SetPerControllerTableProperty( controller, "disableGameSettingsOptions", true )
OpenPopup( menu, "GameSettings_Bots", controller )
end,
customId = "btnSettingUpBots"
}
CoD.LobbyButtons.MP_CUSTOM_SETUP_GAME = {
stringRef = "MPUI_SETUP_GAME_CAPS",
action = OpenSetupGameMP,
customId = "btnSetupGame",
}
local IsGamescomDemo = function ()
return Dvar.ui_execdemo_gamescom:get()
@ -386,6 +410,8 @@ local AddSpacer = function ( options )
end
end
local MapVote = 0
CoD.LobbyMenus.MPButtonsOnline = function ( f26_arg0, f26_arg1, f26_arg2 )
if f26_arg2 == 1 then
AddLargeButton( f26_arg0, f26_arg1, CoD.LobbyButtons.MP_FIND_MATCH )
@ -410,6 +436,50 @@ CoD.LobbyMenus.MPButtonsOnline = function ( f26_arg0, f26_arg1, f26_arg2 )
end
AddSpacer( f26_arg1 )
AddSmallButton( f26_arg0, f26_arg1, CoD.LobbyButtons.MP_STATS )
MapVote = 1
end
CoD.LobbyMenus.MPButtonsOnlinePublic = function ( f27_arg0, f27_arg1, f27_arg2 )
if MapVote == 1 then
Engine.Exec(nil, "LobbyStopDemo") -- Enable map vote at start lobby
MapVote = 0
end
AddLargeButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_START_GAME ) --Launch match button
AddSpacer( f27_arg1 )
AddLargeButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_CAC )
AddLargeButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_SPECIALISTS )
AddLargeButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_SCORESTREAKS )
if Engine.DvarBool( nil, "inventory_test_button_visible" ) then
AddLargeButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_INVENTORY_TEST )
end
--[[local f27_local0 = Engine.GetPlaylistInfoByID( Engine.GetPlaylistID() )
if f27_local0 then
local f27_local1 = f27_local0.playlist.category
if f27_local1 == Engine.GetPlaylistCategoryIdByName( "core" ) or f27_local1 == Engine.GetPlaylistCategoryIdByName( "hardcore" ) then
AddSpacer( f27_arg1 )
AddSmallButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_PUBLIC_LOBBY_LEADERBOARD )
end
end
]] if not DisableBlackMarket() then
AddSpacer( f27_arg1 )
AddLargeButton( f27_arg0, f27_arg1, CoD.LobbyButtons.BLACK_MARKET )
end
AddSpacer( f27_arg1 )
AddSmallButton( f27_arg0, f27_arg1, CoD.LobbyButtons.MP_CUSTOM_SETUP_GAME ) --Setup game in public lobby
end
CoD.LobbyMenus.MPButtonsArenaGame = function ( f31_arg0, f31_arg1, f31_arg2 )
AddLargeButton( f31_arg0, f31_arg1, CoD.LobbyButtons.MP_START_GAME ) --Launch match button
AddSpacer( f31_arg1 )
AddLargeButton( f31_arg0, f31_arg1, CoD.LobbyButtons.MP_CAC )
AddLargeButton( f31_arg0, f31_arg1, CoD.LobbyButtons.MP_SPECIALISTS )
AddLargeButton( f31_arg0, f31_arg1, CoD.LobbyButtons.MP_SCORESTREAKS )
if not DisableBlackMarket() then
AddSpacer( f31_arg1 )
AddLargeButton( f31_arg0, f31_arg1, CoD.LobbyButtons.BLACK_MARKET )
end
AddSpacer( f31_arg1 )
AddSmallButton( f31_arg0, f31_arg1, CoD.LobbyButtons.SETTING_UP_BOTS ) --Bot setting button in public lobby
end
CoD.LobbyMenus.ZMButtonsOnline = function ( f33_arg0, f33_arg1, f33_arg2 )
@ -424,9 +494,8 @@ CoD.LobbyMenus.ZMButtonsOnline = function ( f33_arg0, f33_arg1, f33_arg2 )
AddSpacer( f33_arg1 )
end
AddLargeButton( f33_arg0, f33_arg1, CoD.LobbyButtons.ZM_BUBBLEGUM_BUFFS )
-- Disable these for now, demonware emulation still needs to be implemented
--AddLargeButton( f33_arg0, f33_arg1, CoD.LobbyButtons.ZM_MEGACHEW_FACTORY )
--AddLargeButton( f33_arg0, f33_arg1, CoD.LobbyButtons.ZM_GOBBLEGUM_RECIPES )
AddLargeButton( f33_arg0, f33_arg1, CoD.LobbyButtons.ZM_MEGACHEW_FACTORY )
AddLargeButton( f33_arg0, f33_arg1, CoD.LobbyButtons.ZM_GOBBLEGUM_RECIPES )
AddLargeButton( f33_arg0, f33_arg1, CoD.LobbyButtons.ZM_BUILD_KITS )
AddSpacer( f33_arg1 )
AddSmallButton( f33_arg0, f33_arg1, CoD.LobbyButtons.MP_STATS )
@ -465,6 +534,7 @@ local targetButtons = {
[LobbyData.UITargets.UI_MPLOBBYONLINETHEATER.id] = CoD.LobbyMenus.ButtonsTheaterGame,
[LobbyData.UITargets.UI_ZMLOBBYONLINETHEATER.id] = CoD.LobbyMenus.ButtonsTheaterGame
}
CoD.LobbyMenus.AddButtonsForTarget = function ( controller, id )
local buttonFunc = targetButtons[id]
local model = nil