From bc6ece9560ea1ff5c7e22594e4ad7b05567d064a Mon Sep 17 00:00:00 2001 From: WantedDV <122710241+WantedDV@users.noreply.github.com> Date: Mon, 15 May 2023 15:05:51 -0230 Subject: [PATCH] automate setting of problematic party dvars --- data/ui_scripts/party/__init__.lua | 34 ++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/data/ui_scripts/party/__init__.lua b/data/ui_scripts/party/__init__.lua index cd6c5e3e..98df2e48 100644 --- a/data/ui_scripts/party/__init__.lua +++ b/data/ui_scripts/party/__init__.lua @@ -1,3 +1,25 @@ +local getModeInfo = function() + local id = Engine.GetLobbyUIScreen() + return LobbyData:UITargetFromId(id) +end + +local getMaxClients = function() + local modeInfo = getModeInfo() + return modeInfo.maxClients +end + +-- Disable setting party privacy in menu. Auto set to open + max. +Engine.SetDvar("partyprivacyenabled", 0) +Engine.SetDvar("tu4_partyprivacyuseglobal", 0) +Engine.SetDvar("tu4_partyprivacyluacheck", 0) + +local maxClients = getMaxClients() + +-- Fix for invisible bots in custom games +if maxClients >= 1 then + return Engine.SetDvar("party_maxplayers", maxClients) +end + if not Engine.IsInGame() then return end @@ -11,17 +33,7 @@ CoD.IsTeamChangeAllowed = function() end end -local getModeInfo = function() - local id = Engine.GetLobbyUIScreen() - return LobbyData:UITargetFromId(id) -end - -local getMaxClients = function() - local modeInfo = getModeInfo() - return modeInfo.maxClients -end - -- Set com_maxclients InGame so players can join via direct connect (default from lobbydata) -Engine.SetDvar("com_maxclients", getMaxClients()) +Engine.SetDvar("com_maxclients", maxClients) require("datasources_start_menu_game_options")