Fix Mapvote resetting lobby

- sets the map then wait for player to start game
- correctly sets the voted map
This commit is contained in:
WantedDV 2023-04-11 16:44:59 -02:30
parent 87f19d4937
commit 6668869b7d
2 changed files with 22 additions and 7 deletions

View File

@ -2,6 +2,8 @@ if Engine.GetCurrentMap() ~= "core_frontend" then
return return
end end
local EnableLobbyMapVote = true -- toggle map vote in public lobby
local utils = require("utils") local utils = require("utils")
require("DataSources_StartMenuTabs") require("DataSources_StartMenuTabs")
@ -51,7 +53,13 @@ CoD.LobbyButtons.MP_CUSTOM_SETUP_GAME = {
customId = "btnSetupGame", customId = "btnSetupGame",
} }
local shouldShowMapVote = false local LobbyMapVoteIsEnabled = EnableLobbyMapVote
local LobbyMapVote = function( LobbyMapVoteIsEnabled )
if LobbyMapVoteIsEnabled == true then
Engine.Exec( nil, "LobbyStopDemo" )
end
end
local addCustomButtons = function(controller, menuId, buttonTable, isLeader) local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id or menuId == LobbyData.UITargets.UI_ZMLOBBYONLINE.id then
utils.AddSpacer(buttonTable) utils.AddSpacer(buttonTable)
@ -63,13 +71,10 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
end end
if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id then if menuId == LobbyData.UITargets.UI_MPLOBBYONLINE.id then
shouldShowMapVote = true LobbyMapVoteIsEnabled = EnableLobbyMapVote
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then
if shouldShowMapVote == true then LobbyMapVote( LobbyMapVoteIsEnabled )
shouldShowMapVote = false LobbyMapVoteIsEnabled = false
--Enable map vote at start lobby
Engine.Exec(nil, "LobbyStopDemo")
end
utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1) --Launch match button utils.AddLargeButton(controller, buttonTable, CoD.LobbyButtons.MP_START_GAME, 1) --Launch match button
utils.AddSpacer(buttonTable, 1) utils.AddSpacer(buttonTable, 1)

View File

@ -0,0 +1,10 @@
if Engine.GetCurrentMap() ~= "core_frontend" then
return
end
Engine.SetDvar( "lobbyMigrate_Enabled", 0 )
Engine.SetDvar( "lobbyTimerStatusVotingInterval", 11000 )
Engine.SetDvar( "lobbyTimerStatusBeginInterval", 10 )
Engine.SetDvar( "lobbyTimerStatusStartInterval", 10 )
Engine.SetDvar( "lobbyTimerStatusPostGameInterval", 10 )
Engine.SetDvar( "lobbyTimerStatusVotingInterval_Arena", 11000 )