From 272094f76d5a97f678e8df5875c2ecc0580d217d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=82=AF=20=20=E3=82=A2=E3=83=BC?= =?UTF-8?q?=E3=82=A6=E3=82=A7=E3=83=B3=E3=83=88?= Date: Sun, 3 Jul 2022 18:19:57 +0200 Subject: [PATCH] Disable useless things (#153) --- data/ui_scripts/patches/__init__.lua | 1 + .../patches/disable_useless_things.lua | 17 +++++++++++++++++ src/client/resources/ui_scripts/common.lua | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 data/ui_scripts/patches/disable_useless_things.lua diff --git a/data/ui_scripts/patches/__init__.lua b/data/ui_scripts/patches/__init__.lua index 455a0653..b5a19097 100644 --- a/data/ui_scripts/patches/__init__.lua +++ b/data/ui_scripts/patches/__init__.lua @@ -6,6 +6,7 @@ if (Engine.InFrontend()) then require("shaderdialog") require("gamemodes") require("no_mode_switch") + require("disable_useless_things") end -- defined in mp_hud/hudutils.lua diff --git a/data/ui_scripts/patches/disable_useless_things.lua b/data/ui_scripts/patches/disable_useless_things.lua new file mode 100644 index 00000000..28000a11 --- /dev/null +++ b/data/ui_scripts/patches/disable_useless_things.lua @@ -0,0 +1,17 @@ +-- Disable CP +Engine.SetDvarInt("ui_enable_cp", 0) + +-- Disable CP store +Engine.SetDvarInt("ui_show_store", 0) + +-- Remove CoD account button +if Engine.IsMultiplayer() then + LUI.removemenubutton("pc_controls", 4) +end + +-- Remove social button +LUI.MenuBuilder.m_definitions["online_friends_widget"] = function() + return { + type = "UIElement" + } +end diff --git a/src/client/resources/ui_scripts/common.lua b/src/client/resources/ui_scripts/common.lua index f106207c..2c7bbdf2 100644 --- a/src/client/resources/ui_scripts/common.lua +++ b/src/client/resources/ui_scripts/common.lua @@ -147,6 +147,24 @@ LUI.addmenubutton = function(name, data) end) end +LUI.removemenubutton = function(name, index) + LUI.onmenuopen(name, function(menu) + if (not menu.list) then + return + end + + local buttonlist = menu:getChildById(menu.type .. "_list") + local button = buttonlist.childRecord[string.format("%s_button_%s", name, index)] + buttonlist:removeElement(button) + + local hintbox = menu.optionTextInfo + menu:removeElement(hintbox) + + LUI.Options.InitScrollingList(menu.list, nil) + menu.optionTextInfo = LUI.Options.AddOptionTextInfo(menu) + end) +end + LUI.openmenu = function(menu, args) stack = args LUI.FlowManager.RequestAddMenu(nil, menu)