From bcd530ae4b0c8127dd7421fc61f9d2cf648d38a6 Mon Sep 17 00:00:00 2001 From: javiertringol Date: Sun, 28 Dec 2025 16:52:02 -0300 Subject: [PATCH 1/2] Remove redundant settings save in options.lua Removed unnecessary settings save call. --- modules/client_options/options.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index 672fb691e6..1eab8224a7 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -262,9 +262,6 @@ local function setup() end end end, 100) - - -- Ensure settings are saved - g_settings.save() end From bb7a9e7487080305750f2accd16b25b8c8e89512 Mon Sep 17 00:00:00 2001 From: javiertringol Date: Sun, 28 Dec 2025 16:53:33 -0300 Subject: [PATCH 2/2] fix issues --- modules/client_options/data_options.lua | 147 +++++++++--------------- 1 file changed, 56 insertions(+), 91 deletions(-) diff --git a/modules/client_options/data_options.lua b/modules/client_options/data_options.lua index 1541169cb1..20e11011b5 100644 --- a/modules/client_options/data_options.lua +++ b/modules/client_options/data_options.lua @@ -27,42 +27,29 @@ return { value = g_platform.isMobile() and true or false, action = function(value, options, controller, panels, extraWidgets) -- Update the mouseControlMode based on this option + -- 0 = Regular Controls, 1 = Classic Controls, 2 = Left Smart-Click local mouseControlMode = 0 if value == true then - mouseControlMode = 1 - -- Update settings directly to ensure persistence - g_settings.set('mouseControlMode', mouseControlMode) - options.mouseControlMode.value = mouseControlMode - - -- Update loot control visibility - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - lootControlModeCombobox:setVisible(true) - end + mouseControlMode = 1 -- Classic Controls elseif options.smartLeftClick.value == true then - mouseControlMode = 2 - -- Update settings directly to ensure persistence - g_settings.set('mouseControlMode', mouseControlMode) - options.mouseControlMode.value = mouseControlMode - - -- Update loot control visibility - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - lootControlModeCombobox:setVisible(false) - end + mouseControlMode = 2 -- Left Smart-Click else - mouseControlMode = 0 - -- Update settings directly to ensure persistence - g_settings.set('mouseControlMode', mouseControlMode) - options.mouseControlMode.value = mouseControlMode - - -- Update loot control visibility - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - lootControlModeCombobox:setVisible(false) - end + mouseControlMode = 0 -- Regular Controls + end + + -- Update the value in options table first + options.mouseControlMode.value = mouseControlMode + + -- Then update settings + g_settings.set('mouseControlMode', mouseControlMode) + + -- Update loot control visibility (only visible for Classic Controls) + local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') + if lootControlModeCombobox then + lootControlModeCombobox:setVisible(mouseControlMode == 1) end + -- Update the combobox UI local mouseControlModeCombobox = panels.generalPanel:recursiveGetChildById('mouseControlMode') if mouseControlModeCombobox then mouseControlModeCombobox:setCurrentOption(mouseControlMode, true) @@ -73,42 +60,29 @@ return { value = false, action = function(value, options, controller, panels, extraWidgets) -- Update the mouseControlMode based on this option + -- 0 = Regular Controls, 1 = Classic Controls, 2 = Left Smart-Click local mouseControlMode = 0 if options.classicControl.value == true then - mouseControlMode = 1 - -- Update settings directly to ensure persistence - g_settings.set('mouseControlMode', mouseControlMode) - options.mouseControlMode.value = mouseControlMode - - -- Update loot control visibility - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - lootControlModeCombobox:setVisible(true) - end + mouseControlMode = 1 -- Classic Controls elseif value == true then - mouseControlMode = 2 - -- Update settings directly to ensure persistence - g_settings.set('mouseControlMode', mouseControlMode) - options.mouseControlMode.value = mouseControlMode - - -- Update loot control visibility - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - lootControlModeCombobox:setVisible(false) - end + mouseControlMode = 2 -- Left Smart-Click else - mouseControlMode = 0 - -- Update settings directly to ensure persistence - g_settings.set('mouseControlMode', mouseControlMode) - options.mouseControlMode.value = mouseControlMode - - -- Update loot control visibility - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - lootControlModeCombobox:setVisible(false) - end + mouseControlMode = 0 -- Regular Controls + end + + -- Update the value in options table first + options.mouseControlMode.value = mouseControlMode + + -- Then update settings + g_settings.set('mouseControlMode', mouseControlMode) + + -- Update loot control visibility (only visible for Classic Controls) + local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') + if lootControlModeCombobox then + lootControlModeCombobox:setVisible(mouseControlMode == 1) end + -- Update the combobox UI local mouseControlModeCombobox = panels.generalPanel:recursiveGetChildById('mouseControlMode') if mouseControlModeCombobox then mouseControlModeCombobox:setCurrentOption(mouseControlMode, true) @@ -118,32 +92,8 @@ return { mouseControlMode = { value = 0, -- Default to "Regular Controls" action = function(value, options, controller, panels, extraWidgets) - -- We need a small delay to ensure the UI updates correctly - scheduleEvent(function() - -- Update the mouseControlMode combobox - get it fresh each time - local mouseControlModeCombobox = panels.generalPanel:recursiveGetChildById('mouseControlMode') - if mouseControlModeCombobox then - -- Force the combobox to select the right option - for i = 0, 2 do - if i == value then - mouseControlModeCombobox:setCurrentOptionByData(i) - break - end - end - end - - -- Update loot control mode visibility based on selection - local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') - if lootControlModeCombobox then - if value == 1 then - lootControlModeCombobox:setVisible(true) - else - lootControlModeCombobox:setVisible(false) - end - end - end, 50) - - -- Also update the underlying options + -- Update the underlying options values first + -- 0 = Regular Controls, 1 = Classic Controls, 2 = Left Smart-Click if value == 0 then options.classicControl.value = false options.smartLeftClick.value = false @@ -161,8 +111,26 @@ return { g_settings.set('smartLeftClick', true) end - -- Force save - g_settings.save() + -- Schedule UI updates to ensure they happen after value updates + scheduleEvent(function() + -- Update the mouseControlMode combobox + local mouseControlModeCombobox = panels.generalPanel:recursiveGetChildById('mouseControlMode') + if mouseControlModeCombobox then + -- Force the combobox to select the right option + for i = 0, 2 do + if i == value then + mouseControlModeCombobox:setCurrentOptionByData(i) + break + end + end + end + + -- Update loot control mode visibility (only visible for Classic Controls) + local lootControlModeCombobox = panels.generalPanel:recursiveGetChildById('lootControlMode') + if lootControlModeCombobox then + lootControlModeCombobox:setVisible(value == 1) + end + end, 50) end }, lootControlMode = { @@ -182,9 +150,6 @@ return { end end end, 50) - - -- Force save - g_settings.save() end }, smartWalk = false,