Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 56 additions & 91 deletions modules/client_options/data_options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -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 = {
Expand All @@ -182,9 +150,6 @@ return {
end
end
end, 50)

-- Force save
g_settings.save()
end
},
smartWalk = false,
Expand Down
3 changes: 0 additions & 3 deletions modules/client_options/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,6 @@ local function setup()
end
end
end, 100)

-- Ensure settings are saved
g_settings.save()
end


Expand Down