fix: added call to original AddButtonsForTarget incase mod uses different lobbymenu names
This commit is contained in:
parent
6e4b61c0f5
commit
2f3feade70
@ -1,5 +1,5 @@
|
|||||||
if Engine.GetCurrentMap() ~= "core_frontend" then
|
if Engine.GetCurrentMap() ~= "core_frontend" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
@ -53,9 +53,10 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
|
|||||||
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then
|
elseif menuId == LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id then
|
||||||
if shouldShowMapVote == true then
|
if shouldShowMapVote == true then
|
||||||
shouldShowMapVote = false
|
shouldShowMapVote = false
|
||||||
Engine.Exec(nil, "LobbyStopDemo") -- Enable map vote at start lobby
|
--Enable map vote at start lobby
|
||||||
|
Engine.Exec(nil, "LobbyStopDemo")
|
||||||
end
|
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)
|
||||||
|
|
||||||
utils.AddSpacer(buttonTable)
|
utils.AddSpacer(buttonTable)
|
||||||
@ -66,42 +67,8 @@ local addCustomButtons = function(controller, menuId, buttonTable, isLeader)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local targetButtons = {
|
local oldAddButtonsForTarget = CoD.LobbyMenus.AddButtonsForTarget
|
||||||
[LobbyData.UITargets.UI_MAIN.id] = CoD.LobbyMenus.ModeSelect,
|
|
||||||
[LobbyData.UITargets.UI_MODESELECT.id] = CoD.LobbyMenus.ModeSelect,
|
|
||||||
[LobbyData.UITargets.UI_CPLOBBYLANGAME.id] = CoD.LobbyMenus.CPButtonsLAN,
|
|
||||||
[LobbyData.UITargets.UI_CPLOBBYLANCUSTOMGAME.id] = CoD.LobbyMenus.CPButtonsLANCUSTOM,
|
|
||||||
[LobbyData.UITargets.UI_CPLOBBYONLINE.id] = CoD.LobbyMenus.CPButtonsOnline,
|
|
||||||
[LobbyData.UITargets.UI_CPLOBBYONLINEPUBLICGAME.id] = CoD.LobbyMenus.CPButtonsPublicGame,
|
|
||||||
[LobbyData.UITargets.UI_CPLOBBYONLINECUSTOMGAME.id] = CoD.LobbyMenus.CPButtonsCustomGame,
|
|
||||||
[LobbyData.UITargets.UI_CP2LOBBYLANGAME.id] = CoD.LobbyMenus.CPZMButtonsLAN,
|
|
||||||
[LobbyData.UITargets.UI_CP2LOBBYLANCUSTOMGAME.id] = CoD.LobbyMenus.CPButtonsLANCUSTOM,
|
|
||||||
[LobbyData.UITargets.UI_CP2LOBBYONLINE.id] = CoD.LobbyMenus.CPZMButtonsOnline,
|
|
||||||
[LobbyData.UITargets.UI_CP2LOBBYONLINEPUBLICGAME.id] = CoD.LobbyMenus.CPZMButtonsPublicGame,
|
|
||||||
[LobbyData.UITargets.UI_CP2LOBBYONLINECUSTOMGAME.id] = CoD.LobbyMenus.CPButtonsCustomGame,
|
|
||||||
[LobbyData.UITargets.UI_DOALOBBYLANGAME.id] = CoD.LobbyMenus.DOAButtonsLAN,
|
|
||||||
[LobbyData.UITargets.UI_DOALOBBYONLINE.id] = CoD.LobbyMenus.DOAButtonsOnline,
|
|
||||||
[LobbyData.UITargets.UI_DOALOBBYONLINEPUBLICGAME.id] = CoD.LobbyMenus.DOAButtonsPublicGame,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYLANGAME.id] = CoD.LobbyMenus.MPButtonsLAN,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYMAIN.id] = CoD.LobbyMenus.MPButtonsMain,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINE.id] = CoD.LobbyMenus.MPButtonsOnline,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINEPUBLICGAME.id] = CoD.LobbyMenus.MPButtonsOnlinePublic,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINEMODGAME.id] = CoD.LobbyMenus.MPButtonsModGame,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINECUSTOMGAME.id] = CoD.LobbyMenus.MPButtonsCustomGame,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINEARENA.id] = CoD.LobbyMenus.MPButtonsArena,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINEARENAGAME.id] = CoD.LobbyMenus.MPButtonsArenaGame,
|
|
||||||
[LobbyData.UITargets.UI_FRLOBBYONLINEGAME.id] = CoD.LobbyMenus.FRButtonsOnlineGame,
|
|
||||||
[LobbyData.UITargets.UI_FRLOBBYLANGAME.id] = CoD.LobbyMenus.FRButtonsLANGame,
|
|
||||||
[LobbyData.UITargets.UI_ZMLOBBYLANGAME.id] = CoD.LobbyMenus.ZMButtonsLAN,
|
|
||||||
[LobbyData.UITargets.UI_ZMLOBBYONLINE.id] = CoD.LobbyMenus.ZMButtonsOnline,
|
|
||||||
[LobbyData.UITargets.UI_ZMLOBBYONLINEPUBLICGAME.id] = CoD.LobbyMenus.ZMButtonsPublicGame,
|
|
||||||
[LobbyData.UITargets.UI_ZMLOBBYONLINECUSTOMGAME.id] = CoD.LobbyMenus.ZMButtonsCustomGame,
|
|
||||||
[LobbyData.UITargets.UI_MPLOBBYONLINETHEATER.id] = CoD.LobbyMenus.ButtonsTheaterGame,
|
|
||||||
[LobbyData.UITargets.UI_ZMLOBBYONLINETHEATER.id] = CoD.LobbyMenus.ButtonsTheaterGame
|
|
||||||
}
|
|
||||||
|
|
||||||
CoD.LobbyMenus.AddButtonsForTarget = function(controller, id)
|
CoD.LobbyMenus.AddButtonsForTarget = function(controller, id)
|
||||||
local buttonFunc = targetButtons[id]
|
|
||||||
local model = nil
|
local model = nil
|
||||||
if Engine.IsLobbyActive(Enum.LobbyType.LOBBY_TYPE_GAME) then
|
if Engine.IsLobbyActive(Enum.LobbyType.LOBBY_TYPE_GAME) then
|
||||||
model = Engine.GetModel(DataSources.LobbyRoot.getModel(controller), "gameClient.isHost")
|
model = Engine.GetModel(DataSources.LobbyRoot.getModel(controller), "gameClient.isHost")
|
||||||
@ -114,8 +81,7 @@ CoD.LobbyMenus.AddButtonsForTarget = function(controller, id)
|
|||||||
else
|
else
|
||||||
isLeader = 1
|
isLeader = 1
|
||||||
end
|
end
|
||||||
local result = {}
|
local result = oldAddButtonsForTarget(controller, id)
|
||||||
buttonFunc(controller, result, isLeader)
|
|
||||||
addCustomButtons(controller, id, result, isLeader)
|
addCustomButtons(controller, id, result, isLeader)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user