Configure default hotkey, fix map release

This commit is contained in:
Henrique Santiago 2013-01-25 10:22:51 -02:00
parent 839495fa9b
commit 95f79b45dc
2 changed files with 20 additions and 10 deletions

View File

@ -28,6 +28,7 @@ clearObjectButton = nil
useOnSelf = nil
useOnTarget = nil
useWith = nil
defaultComboKeys = nil
hotkeyList = {}
-- public functions
@ -170,14 +171,24 @@ function reload()
end
function loadDefautComboKeys()
for i=1,12 do
addKeyCombo(nil, 'F' .. i)
end
for i=1,4 do
addKeyCombo(nil, 'Shift+F' .. i)
if not defaultComboKeys then
for i=1,12 do
addKeyCombo(nil, 'F' .. i)
end
for i=1,4 do
addKeyCombo(nil, 'Shift+F' .. i)
end
else
for keyCombo, keySettings in pairs(defaultComboKeys) do
addKeyCombo(nil, keyCombo, keySettings)
end
end
end
function setDefaultComboKeys(combo)
defaultComboKeys = combo
end
-- private functions
function onGameStart()
reload()

View File

@ -17,7 +17,7 @@ function UIGameMap:onDragEnter(mousePos)
self.currentDragThing = thing
g_mouse.setTargetCursor()
self.cancelNextRelease = true
self.allowNextRelease = false
return true
end
@ -50,12 +50,11 @@ function UIGameMap:onDrop(widget, mousePos)
end
function UIGameMap:onMousePress()
self.cancelNextRelease = false
self.allowNextRelease = true
end
function UIGameMap:onMouseRelease(mousePosition, mouseButton)
if self.cancelNextRelease then
self.cancelNextRelease = false
if not self.allowNextRelease then
return true
end
@ -86,7 +85,7 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
local ret = modules.game_interface.processMouseAction(mousePosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing)
if ret then
self.cancelNextRelease = true
self.allowNextRelease = false
end
return ret