Skip to content

Commit e98cb51

Browse files
committed
fix(mo): hide mod overrides status for search row
1 parent 77f8887 commit e98cb51

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Mod Options Search Filter
22

3-
Adds a search/filter field to the top of the BLT mod options list.
3+
Adds a search/filter field to the top of the BLT mod options list and Mod Overrides list.
44

55
Type in the `Filter` input to narrow the visible mods by mod name or description.
66

modules/mo/menu.lua

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ _G.ModOptionsSearchFilter = _G.ModOptionsSearchFilter or {}
22

33
local ModOptionsSearchFilter = _G.ModOptionsSearchFilter
44

5+
local empty_mod_info_item = {
6+
parameters = function()
7+
return { back = true }
8+
end
9+
}
10+
511
function ModOptionsSearchFilter:RegisterModOverridesMenuCallbacks()
612
if not MenuCallbackHandler then
713
return false
@@ -17,8 +23,37 @@ end
1723
function ModOptionsSearchFilter:InstallMenuModInfoGuiPatch()
1824
local setup_patched = self:InstallMenuRendererPatch(MenuModInfoGui, "_mod_options_search_setup_item_rows_patched")
1925
local update_patched = self:InstallMenuRendererUpdatePatch(MenuModInfoGui, "_mod_options_search_update_patched")
26+
local info_patched = self:InstallMenuModInfoGuiSearchInfoPatch()
27+
28+
return setup_patched or update_patched or info_patched
29+
end
30+
31+
function ModOptionsSearchFilter:IsModOverridesSearchItem(item)
32+
return self:ItemParameters(item).name == self.MOD_OVERRIDES_INPUT_ID
33+
end
34+
35+
function ModOptionsSearchFilter:InstallMenuModInfoGuiSearchInfoPatch()
36+
if not MenuModInfoGui or MenuModInfoGui._mod_options_search_set_mod_info_patched then
37+
return false
38+
end
2039

21-
return setup_patched or update_patched
40+
local original_set_mod_info = MenuModInfoGui.set_mod_info
41+
42+
if type(original_set_mod_info) ~= "function" then
43+
return false
44+
end
45+
46+
MenuModInfoGui._mod_options_search_set_mod_info_patched = true
47+
48+
function MenuModInfoGui:set_mod_info(item, ...)
49+
if ModOptionsSearchFilter:IsModOverridesSearchItem(item) then
50+
return original_set_mod_info(self, empty_mod_info_item, ...)
51+
end
52+
53+
return original_set_mod_info(self, item, ...)
54+
end
55+
56+
return true
2257
end
2358

2459
function ModOptionsSearchFilter:InstallModMenuCreatorPatch()

0 commit comments

Comments
 (0)