From 87f19d4937229bdf69e455173b99d116d5c73bbe Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:34:04 -0230 Subject: [PATCH] Enable Barracks menu with mods loaded --- .../DataSources_StartMenuTabs.lua | 217 ++++++++++++++++++ data/ui_scripts/frontend_menus/__init__.lua | 1 + 2 files changed, 218 insertions(+) create mode 100644 data/ui_scripts/frontend_menus/DataSources_StartMenuTabs.lua diff --git a/data/ui_scripts/frontend_menus/DataSources_StartMenuTabs.lua b/data/ui_scripts/frontend_menus/DataSources_StartMenuTabs.lua new file mode 100644 index 00000000..2a07cb6a --- /dev/null +++ b/data/ui_scripts/frontend_menus/DataSources_StartMenuTabs.lua @@ -0,0 +1,217 @@ +DataSources.StartMenuTabs = ListHelper_SetupDataSource( "StartMenuTabs", function ( f44_arg0 ) + local f44_local0 = {} + table.insert( f44_local0, { + models = { + tabIcon = CoD.buttonStrings.shoulderl + }, + properties = { + m_mouseDisabled = true + } + } ) + if Engine.IsDemoPlaying() then + local f44_local1 = "CoD.StartMenu_GameOptions" + if Engine.IsZombiesGame() then + f44_local1 = "CoD.StartMenu_GameOptions_ZM" + end + table.insert( f44_local0, { + models = { + tabName = Engine.Localize( "MENU_THEATER_CAPS" ), + tabWidget = f44_local1, + tabIcon = "" + }, + properties = { + tabId = "gameOptions" + } + } ) + elseif Engine.IsInGame() then + if IsGameTypeDOA() and not InSafehouse() then + table.insert( f44_local0, { + models = { + tabName = "DOA", + tabWidget = "CoD.StartMenu_GameOptions_DOA", + tabIcon = "" + }, + properties = { + tabId = "gameOptions" + } + } ) + elseif CoD.isCampaign then + table.insert( f44_local0, { + models = { + tabName = SessionModeToUnlocalizedSessionModeCaps( Engine.CurrentSessionMode() ), + tabWidget = "CoD.StartMenu_GameOptions_CP", + tabIcon = "" + }, + properties = { + tabId = "gameOptions" + } + } ) + if not Engine.IsCampaignModeZombies() then + if CoD.isSafehouse and CoD.isOnlineGame() and not IsInTrainingSim( f44_arg0 ) and Dvar.ui_safehousebarracks:get() and not IsPlayerAGuest( f44_arg0 ) then + table.insert( f44_local0, { + models = { + tabName = "CPUI_BARRACKS_CAPS", + tabWidget = "CoD.CombatRecordCP_Contents", + tabIcon = "" + }, + properties = { + tabId = "combatRecord" + } + } ) + end + if HighestMapReachedGreaterThan( f44_arg0, 1 ) or LUI.DEV ~= nil then + table.insert( f44_local0, { + models = { + tabName = "CPUI_TACTICAL_MODE_CAPS", + tabWidget = "CoD.StartMenu_TacticalMode", + tabIcon = "" + }, + properties = { + tabId = "tacticalMode" + } + } ) + end + if not CoD.isSafehouse and not IsPlayerAGuest( f44_arg0 ) then + table.insert( f44_local0, { + models = { + tabName = "CPUI_ACCOLADES", + tabWidget = "CoD.MissionRecordVault_Challenges", + tabIcon = "" + }, + properties = { + tabId = "accolades" + } + } ) + end + end + elseif Engine.IsZombiesGame() then + table.insert( f44_local0, { + models = { + tabName = SessionModeToUnlocalizedSessionModeCaps( Engine.CurrentSessionMode() ), + tabWidget = "CoD.StartMenu_GameOptions_ZM", + tabIcon = "" + }, + properties = { + tabId = "gameOptions" + } + } ) + else + table.insert( f44_local0, { + models = { + tabName = SessionModeToUnlocalizedSessionModeCaps( Engine.CurrentSessionMode() ), + tabWidget = "CoD.StartMenu_GameOptions", + tabIcon = "" + }, + properties = { + tabId = "gameOptions" + } + } ) + end + else + if not IsPlayerAGuest( f44_arg0 ) then + table.insert( f44_local0, { + models = { + tabName = "MENU_TAB_IDENTITY_CAPS", + tabWidget = "CoD.StartMenu_Identity", + tabIcon = "" + }, + properties = { + tabId = "identity", + disabled = Dvar.ui_execdemo_gamescom:get() + } + } ) + end + if not IsLobbyNetworkModeLAN() and not Dvar.ui_execdemo:get() and not Engine.IsCampaignModeZombies() and not IsPlayerAGuest( f44_arg0 ) then + table.insert( f44_local0, { + models = { + tabName = "MENU_TAB_CHALLENGES_CAPS", + tabWidget = "CoD.StartMenu_Challenges", + tabIcon = "" + }, + properties = { + tabId = "challenges" + } + } ) + local f44_local1 = CoD.isPC + if f44_local1 then + f44_local1 = false --Mods_IsUsingMods() + end + table.insert( f44_local0, { + models = { + tabName = "MENU_TAB_BARRACKS_CAPS", + tabWidget = "CoD.StartMenu_Barracks", + tabIcon = "", + disabled = f44_local1 + }, + properties = { + tabId = "barracks" + } + } ) + if CommunityOptionsEnabled() then + local f44_local2 = CoD.perController[f44_arg0].openMediaTabAfterClosingGroups + CoD.perController[f44_arg0].openMediaTabAfterClosingGroups = false + table.insert( f44_local0, { + models = { + tabName = "MENU_TAB_MEDIA_CAPS", + tabWidget = "CoD.StartMenu_Media", + tabIcon = "" + }, + properties = { + tabId = "media", + selectIndex = f44_local2 + } + } ) + end + end + end + if IsGameTypeDOA() and Engine.IsInGame() and not InSafehouse() then + local f44_local1 = table.insert + local f44_local2 = f44_local0 + local f44_local3 = { + models = { + tabName = "MENU_TAB_OPTIONS_CAPS", + tabWidget = "CoD.StartMenu_Options_DOA", + tabIcon = "" + } + } + local f44_local4 = { + tabId = "options" + } + local f44_local5 = Dvar.ui_execdemo:get() + if f44_local5 then + f44_local5 = not Engine.IsInGame() + end + f44_local4.selectIndex = f44_local5 + f44_local3.properties = f44_local4 + f44_local1( f44_local2, f44_local3 ) + else + local f44_local1 = table.insert + local f44_local2 = f44_local0 + local f44_local3 = { + models = { + tabName = "MENU_TAB_OPTIONS_CAPS", + tabWidget = "CoD.StartMenu_Options", + tabIcon = "" + } + } + local f44_local4 = { + tabId = "options" + } + local f44_local5 = Dvar.ui_execdemo_gamescom:get() + if f44_local5 then + f44_local5 = not Engine.IsInGame() + end + f44_local4.selectIndex = f44_local5 + f44_local3.properties = f44_local4 + f44_local1( f44_local2, f44_local3 ) + end + table.insert( f44_local0, { + models = { + tabIcon = CoD.buttonStrings.shoulderr + }, + properties = { + m_mouseDisabled = true + } + } ) + return f44_local0 +end, true ) \ No newline at end of file diff --git a/data/ui_scripts/frontend_menus/__init__.lua b/data/ui_scripts/frontend_menus/__init__.lua index 6c23d9fc..1b2d3abe 100644 --- a/data/ui_scripts/frontend_menus/__init__.lua +++ b/data/ui_scripts/frontend_menus/__init__.lua @@ -3,6 +3,7 @@ if Engine.GetCurrentMap() ~= "core_frontend" then end local utils = require("utils") +require("DataSources_StartMenuTabs") CoD.LobbyButtons.MP_PUBLIC_MATCH = { stringRef = "MENU_PLAY_CAPS",