Version 0.991 BETA

This commit is contained in:
OTCv8
2019-10-07 15:52:55 +02:00
parent bc977c268e
commit c5c600e83e
12 changed files with 57 additions and 22 deletions

View File

@@ -373,8 +373,23 @@ function addKeyCombo(keyCombo, keySettings, focus)
updateHotkeyLabel(hotkeyLabel)
boundCombosCallback[keyCombo] = function() scheduleEvent(function() doKeyCombo(keyCombo) end, g_settings.getNumber('hotkeyDelay')) end
if keyCombo:lower():find("ctrl") then
if boundCombosCallback[keyCombo] then
g_keyboard.unbindKeyPress(keyCombo, boundCombosCallback[keyCombo])
end
end
boundCombosCallback[keyCombo] = function() prepareKeyCombo(keyCombo) end
g_keyboard.bindKeyPress(keyCombo, boundCombosCallback[keyCombo])
if not keyCombo:lower():find("ctrl") then
local keyComboCtrl = "Ctrl+" .. keyCombo
if not boundCombosCallback[keyComboCtrl] then
boundCombosCallback[keyComboCtrl] = function() prepareKeyCombo(keyComboCtrl) end
g_keyboard.bindKeyPress(keyComboCtrl, boundCombosCallback[keyComboCtrl])
end
end
end
if focus then
@@ -385,6 +400,24 @@ function addKeyCombo(keyCombo, keySettings, focus)
configValueChanged = true
end
function prepareKeyCombo(keyCombo)
local hotKey = hotkeyList[keyCombo]
if keyCombo:lower():find("ctrl") and not hotKey or (hotKey.itemId == nil and (not hotKey.value or #hotKey.value == 0)) then
keyCombo = keyCombo:gsub("Ctrl%+", "")
keyCombo = keyCombo:gsub("ctrl%+", "")
hotKey = hotkeyList[keyCombo]
end
if not hotKey then
return
end
if hotKey.itemId == nil then -- say
scheduleEvent(function() doKeyCombo(keyCombo) end, g_settings.getNumber('hotkeyDelay'))
else
doKeyCombo(keyCombo)
end
end
function doKeyCombo(keyCombo)
if not g_game.isOnline() then return end
if modules.game_console and modules.game_console.isChatEnabled() then