add mods menu in lobby

This commit is contained in:
m 2022-09-03 05:06:45 -05:00
parent 7d3eb31261
commit 11f8702065
4 changed files with 22 additions and 12 deletions

View File

@ -1,3 +1,5 @@
if (game:issingleplayer()) then
require("loading")
require("loading")
if (Engine.InFrontend()) then
require("download")
end

View File

@ -38,14 +38,16 @@ function string:truncate(length)
return self:sub(1, length - 3) .. "..."
end
LUI.addmenubutton("main_campaign", {
if (game:issingleplayer()) then
LUI.addmenubutton("main_campaign", {
index = 6,
text = "@MENU_MODS",
description = Engine.Localize("@MENU_MODS_DESC"),
callback = function()
LUI.FlowManager.RequestAddMenu(nil, "mods_menu")
end
})
})
end
function getmodname(path)
local name = path

View File

@ -28,6 +28,12 @@ function menu_xboxlive(f16_arg0, f16_arg1)
menu:AddBarracksButton()
menu:AddPersonalizationButton()
menu:AddDepotButton()
-- kinda a weird place to do this, but it's whatever
-- add "MODS" button below depot button
local modsButton = menu:AddButton("@MENU_MODS", function(a1, a2)
LUI.FlowManager.RequestAddMenu(a1, "mods_menu", true, nil)
end)
end
local privateMatchButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch,

View File

@ -85,7 +85,7 @@ namespace mods
return;
}
if (!game::Com_InFrontend())
if (!game::Com_InFrontend() && (game::environment::is_mp() && !game::VirtualLobby_Loaded()))
{
console::info("Cannot load mod while in-game!\n");
game::CG_GameMessage(0, "^1Cannot unload mod while in-game!");
@ -125,7 +125,7 @@ namespace mods
return;
}
if (!game::Com_InFrontend())
if (!game::Com_InFrontend() && (game::environment::is_mp() && !game::VirtualLobby_Loaded()))
{
console::info("Cannot unload mod while in-game!\n");
game::CG_GameMessage(0, "^1Cannot unload mod while in-game!");