mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Rework smart walk, fix #247
This commit is contained in:
@@ -74,7 +74,7 @@ local function onWidgetKeyDown(widget, keyCode, keyboardModifiers)
|
||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||
local callback = widget.boundKeyDownCombos[keyComboDesc]
|
||||
if callback then
|
||||
callback()
|
||||
callback(widget, keyCode)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@@ -85,7 +85,7 @@ local function onWidgetKeyUp(widget, keyCode, keyboardModifiers)
|
||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||
local callback = widget.boundKeyUpCombos[keyComboDesc]
|
||||
if callback then
|
||||
callback()
|
||||
callback(widget, keyCode)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@@ -96,7 +96,7 @@ local function onWidgetKeyPress(widget, keyCode, keyboardModifiers, autoRepeatTi
|
||||
local keyComboDesc = determineKeyComboDesc(keyCode, keyboardModifiers)
|
||||
local comboConf = widget.boundKeyPressCombos[keyComboDesc]
|
||||
if comboConf and (autoRepeatTicks >= comboConf.autoRepeatDelay or autoRepeatTicks == 0) and comboConf.callback then
|
||||
comboConf.callback()
|
||||
comboConf.callback(widget, keyCode)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
@@ -81,6 +81,20 @@ function table.removevalue(t, value)
|
||||
end
|
||||
end
|
||||
|
||||
function table.popvalue(value)
|
||||
local index = nil
|
||||
for k,v in pairs(t) do
|
||||
if v == value or not value then
|
||||
index = k
|
||||
end
|
||||
end
|
||||
if index then
|
||||
table.remove(t, index)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function table.compare(t, other)
|
||||
if #t ~= #other then return false end
|
||||
for k,v in pairs(t) do
|
||||
|
Reference in New Issue
Block a user