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 end

View File

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

View File

@ -28,6 +28,12 @@ function menu_xboxlive(f16_arg0, f16_arg1)
menu:AddBarracksButton() menu:AddBarracksButton()
menu:AddPersonalizationButton() menu:AddPersonalizationButton()
menu:AddDepotButton() 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 end
local privateMatchButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch, local privateMatchButton = menu:AddButton("@MENU_PRIVATE_MATCH", MPLobbyOnline.OnPrivateMatch,

View File

@ -85,7 +85,7 @@ namespace mods
return; 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"); console::info("Cannot load mod while in-game!\n");
game::CG_GameMessage(0, "^1Cannot unload mod while in-game!"); game::CG_GameMessage(0, "^1Cannot unload mod while in-game!");
@ -125,7 +125,7 @@ namespace mods
return; 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"); console::info("Cannot unload mod while in-game!\n");
game::CG_GameMessage(0, "^1Cannot unload mod while in-game!"); game::CG_GameMessage(0, "^1Cannot unload mod while in-game!");