From b390e3ffd4c5ae97034278e541b9949575fd2fa2 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:30:22 -0230 Subject: [PATCH 1/5] Allow access to online menus with mod loaded --- data/ui_scripts/ranked/OnlineModsLoaded.lua | 8 ++++++++ data/ui_scripts/ranked/__init__.lua | 1 + 2 files changed, 9 insertions(+) create mode 100644 data/ui_scripts/ranked/OnlineModsLoaded.lua create mode 100644 data/ui_scripts/ranked/__init__.lua diff --git a/data/ui_scripts/ranked/OnlineModsLoaded.lua b/data/ui_scripts/ranked/OnlineModsLoaded.lua new file mode 100644 index 00000000..9262d4c0 --- /dev/null +++ b/data/ui_scripts/ranked/OnlineModsLoaded.lua @@ -0,0 +1,8 @@ +if Engine.GetCurrentMap() ~= "core_frontend" then + return +end + +function ShouldUnloadMod( arg0 ) + return false +end + diff --git a/data/ui_scripts/ranked/__init__.lua b/data/ui_scripts/ranked/__init__.lua new file mode 100644 index 00000000..a76a2649 --- /dev/null +++ b/data/ui_scripts/ranked/__init__.lua @@ -0,0 +1 @@ +require("OnlineModsLoaded") \ No newline at end of file From 0be18b9a5bb52657ae3c3bc7456368ccc9be441d Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Tue, 11 Apr 2023 17:34:19 -0230 Subject: [PATCH 2/5] Auto-load usermaps mod if required for custom map --- data/ui_scripts/ranked/OnlineModsLoaded.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/data/ui_scripts/ranked/OnlineModsLoaded.lua b/data/ui_scripts/ranked/OnlineModsLoaded.lua index 9262d4c0..acafb1a0 100644 --- a/data/ui_scripts/ranked/OnlineModsLoaded.lua +++ b/data/ui_scripts/ranked/OnlineModsLoaded.lua @@ -6,3 +6,20 @@ function ShouldUnloadMod( arg0 ) return false end +-- Load usermaps mod if custom map selected +local MustLoadUsermaps = function( arg0, arg1 ) + if CoD.perController[arg1].mapCategory == CoD.CONTENT_MODS_INDEX then + if not Engine.IsUsingMods() then + LuaUtils.Mods_LoadMod( "usermaps" ) -- LuaUtils.Mods_LoadMod(arg0.loadModName) + + local MENU_MODS_CAPS = Engine.Localize( "MENU_MODS_CAPS" ) + local PLATFORM_MODS_LOADED = Engine.Localize( "PLATFORM_MODS_LOADED" ) + CoD.OverlayUtility.ShowToast( "DefaultState", MENU_MODS_CAPS, PLATFORM_MODS_LOADED .. " " .. arg0.mapName ) + end + end +end + +function MapSelected( arg0, arg1 ) + SetMap( arg1, arg0.mapName, false ) + MustLoadUsermaps( arg0, arg1 ) +end From aded514bddec418f8a83069d8c97bf9360ac3419 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Wed, 12 Apr 2023 14:26:24 -0230 Subject: [PATCH 3/5] use snake_case --- data/ui_scripts/ranked/__init__.lua | 2 +- .../ranked/{OnlineModsLoaded.lua => online_mods_loaded.lua} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename data/ui_scripts/ranked/{OnlineModsLoaded.lua => online_mods_loaded.lua} (100%) diff --git a/data/ui_scripts/ranked/__init__.lua b/data/ui_scripts/ranked/__init__.lua index a76a2649..c8194a7a 100644 --- a/data/ui_scripts/ranked/__init__.lua +++ b/data/ui_scripts/ranked/__init__.lua @@ -1 +1 @@ -require("OnlineModsLoaded") \ No newline at end of file +require("online_mods_loaded") \ No newline at end of file diff --git a/data/ui_scripts/ranked/OnlineModsLoaded.lua b/data/ui_scripts/ranked/online_mods_loaded.lua similarity index 100% rename from data/ui_scripts/ranked/OnlineModsLoaded.lua rename to data/ui_scripts/ranked/online_mods_loaded.lua From 90590d59efd341b0c3418a84e251283ceccae0a3 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Wed, 12 Apr 2023 20:01:46 -0230 Subject: [PATCH 4/5] Lua formatting --- data/ui_scripts/ranked/__init__.lua | 2 +- data/ui_scripts/ranked/online_mods_loaded.lua | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data/ui_scripts/ranked/__init__.lua b/data/ui_scripts/ranked/__init__.lua index c8194a7a..685aa5ca 100644 --- a/data/ui_scripts/ranked/__init__.lua +++ b/data/ui_scripts/ranked/__init__.lua @@ -1 +1 @@ -require("online_mods_loaded") \ No newline at end of file +require("online_mods_loaded") diff --git a/data/ui_scripts/ranked/online_mods_loaded.lua b/data/ui_scripts/ranked/online_mods_loaded.lua index acafb1a0..bec2e0bd 100644 --- a/data/ui_scripts/ranked/online_mods_loaded.lua +++ b/data/ui_scripts/ranked/online_mods_loaded.lua @@ -2,24 +2,24 @@ if Engine.GetCurrentMap() ~= "core_frontend" then return end -function ShouldUnloadMod( arg0 ) +function ShouldUnloadMod(arg0) return false end -- Load usermaps mod if custom map selected -local MustLoadUsermaps = function( arg0, arg1 ) +local mustLoadUsermaps = function(arg0, arg1) if CoD.perController[arg1].mapCategory == CoD.CONTENT_MODS_INDEX then if not Engine.IsUsingMods() then - LuaUtils.Mods_LoadMod( "usermaps" ) -- LuaUtils.Mods_LoadMod(arg0.loadModName) - - local MENU_MODS_CAPS = Engine.Localize( "MENU_MODS_CAPS" ) - local PLATFORM_MODS_LOADED = Engine.Localize( "PLATFORM_MODS_LOADED" ) - CoD.OverlayUtility.ShowToast( "DefaultState", MENU_MODS_CAPS, PLATFORM_MODS_LOADED .. " " .. arg0.mapName ) + LuaUtils.Mods_LoadMod("usermaps") -- LuaUtils.Mods_LoadMod(arg0.loadModName) + + local MENU_MODS_CAPS = Engine.Localize("MENU_MODS_CAPS") + local PLATFORM_MODS_LOADED = Engine.Localize("PLATFORM_MODS_LOADED") + CoD.OverlayUtility.ShowToast("DefaultState", MENU_MODS_CAPS, PLATFORM_MODS_LOADED .. " " .. arg0.mapName) end end end -function MapSelected( arg0, arg1 ) - SetMap( arg1, arg0.mapName, false ) - MustLoadUsermaps( arg0, arg1 ) +function MapSelected(arg0, arg1) + SetMap(arg1, arg0.mapName, false) + mustLoadUsermaps(arg0, arg1) end From a71c48a77f4a6803908aefff066d0c83bb148036 Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Sat, 15 Apr 2023 05:08:08 -0230 Subject: [PATCH 5/5] add variable names --- data/ui_scripts/ranked/online_mods_loaded.lua | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/data/ui_scripts/ranked/online_mods_loaded.lua b/data/ui_scripts/ranked/online_mods_loaded.lua index bec2e0bd..2c388b9b 100644 --- a/data/ui_scripts/ranked/online_mods_loaded.lua +++ b/data/ui_scripts/ranked/online_mods_loaded.lua @@ -7,19 +7,17 @@ function ShouldUnloadMod(arg0) end -- Load usermaps mod if custom map selected -local mustLoadUsermaps = function(arg0, arg1) - if CoD.perController[arg1].mapCategory == CoD.CONTENT_MODS_INDEX then +local mustLoadUsermaps = function(element, controller) + if CoD.perController[controller].mapCategory == CoD.CONTENT_MODS_INDEX then if not Engine.IsUsingMods() then - LuaUtils.Mods_LoadMod("usermaps") -- LuaUtils.Mods_LoadMod(arg0.loadModName) + LuaUtils.Mods_LoadMod("usermaps") -- LuaUtils.Mods_LoadMod(element.loadModName) - local MENU_MODS_CAPS = Engine.Localize("MENU_MODS_CAPS") - local PLATFORM_MODS_LOADED = Engine.Localize("PLATFORM_MODS_LOADED") - CoD.OverlayUtility.ShowToast("DefaultState", MENU_MODS_CAPS, PLATFORM_MODS_LOADED .. " " .. arg0.mapName) + CoD.OverlayUtility.ShowToast("DefaultState", Engine.Localize("MENU_MODS_CAPS"), Engine.Localize("PLATFORM_MODS_LOADED") .. " " .. element.mapName) end end end -function MapSelected(arg0, arg1) - SetMap(arg1, arg0.mapName, false) - mustLoadUsermaps(arg0, arg1) +function MapSelected(element, controller) + SetMap(controller, element.mapName, false) + mustLoadUsermaps(element, controller) end