Fixed the visual glitch if there are 2 (or more) mods with the same name (options menu)
This commit is contained in:
parent
33aaafce97
commit
905d1348b3
1 changed files with 12 additions and 2 deletions
|
@ -1314,6 +1314,7 @@ VMFOptionsView.sort_settings_list_widgets = function (self)
|
||||||
|
|
||||||
local favorited_mods_widgets = {}
|
local favorited_mods_widgets = {}
|
||||||
local favorited_mods_names = {}
|
local favorited_mods_names = {}
|
||||||
|
|
||||||
local regular_mods_widgets = {}
|
local regular_mods_widgets = {}
|
||||||
local regular_mods_names = {}
|
local regular_mods_names = {}
|
||||||
|
|
||||||
|
@ -1323,9 +1324,18 @@ VMFOptionsView.sort_settings_list_widgets = function (self)
|
||||||
favorited_mods_widgets[mod_widgets[1].content.mod_name] = mod_widgets
|
favorited_mods_widgets[mod_widgets[1].content.mod_name] = mod_widgets
|
||||||
table.insert(favorited_mods_names, mod_widgets[1].content.mod_name)
|
table.insert(favorited_mods_names, mod_widgets[1].content.mod_name)
|
||||||
else
|
else
|
||||||
|
|
||||||
|
-- if there are 2 (or more) mods with the absolutely same name
|
||||||
|
if regular_mods_widgets[mod_widgets[1].content.text] then
|
||||||
|
local random_number = tostring(math.random(10000))
|
||||||
|
|
||||||
|
regular_mods_widgets[mod_widgets[1].content.text .. random_number] = mod_widgets
|
||||||
|
table.insert(regular_mods_names, mod_widgets[1].content.text .. random_number)
|
||||||
|
else
|
||||||
regular_mods_widgets[mod_widgets[1].content.text] = mod_widgets
|
regular_mods_widgets[mod_widgets[1].content.text] = mod_widgets
|
||||||
table.insert(regular_mods_names, mod_widgets[1].content.text)
|
table.insert(regular_mods_names, mod_widgets[1].content.text)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- favorite mods sorting + cleaning up the favs list
|
-- favorite mods sorting + cleaning up the favs list
|
||||||
|
@ -1342,7 +1352,7 @@ VMFOptionsView.sort_settings_list_widgets = function (self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vmf:set("options_menu_favorite_mods", new_favorite_mods_list)
|
vmf:set("options_menu_favorite_mods", new_favorite_mods_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1487,7 +1497,7 @@ end
|
||||||
|
|
||||||
VMFOptionsView.callback_setting_changed = function (self, mod_name, setting_name, old_value, new_value)
|
VMFOptionsView.callback_setting_changed = function (self, mod_name, setting_name, old_value, new_value)
|
||||||
--vmf:echo("CHANGED: " .. mod_name .. " " .. setting_name .. " " .. tostring(old_value) .. " " .. tostring(new_value))
|
--vmf:echo("CHANGED: " .. mod_name .. " " .. setting_name .. " " .. tostring(old_value) .. " " .. tostring(new_value))
|
||||||
vmf:echo("whatever")
|
|
||||||
if self.is_setting_changes_applied_immidiately then
|
if self.is_setting_changes_applied_immidiately then
|
||||||
get_mod(mod_name):set(setting_name, new_value, true)
|
get_mod(mod_name):set(setting_name, new_value, true)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue