start implementing classic controls

This commit is contained in:
Henrique Santiago 2012-01-09 16:51:11 -02:00
parent 3230095cea
commit ef82fc1554
1 changed files with 16 additions and 2 deletions

View File

@ -1,13 +1,27 @@
function UIMap:onMousePress(mousePos, mouseButton) function UIMap:onMouseRelease(mousePos, mouseButton)
local tile = self:getTile(mousePos) local tile = self:getTile(mousePos)
if not tile then return false end if not tile then return false end
local keyboardModifiers = g_window.getKeyboardModifiers()
print ("lol " .. keyboardModifiers)
if not Options.classicControl then if not Options.classicControl then
if mouseButton == MouseRightButton then if keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton then
-- auto walk
return true
elseif keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
Game.createThingMenu(mousePos, tile:getTopLookThing(), tile:getTopUseThing(), tile:getTopCreature()) Game.createThingMenu(mousePos, tile:getTopLookThing(), tile:getTopUseThing(), tile:getTopCreature())
return true return true
elseif keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseRightButton or mouseButton == MouseLeftButton) then
Game.look(tile:getTopLookThing())
return true
elseif keyboardModifiers == KeyboardCtrlModifier and (mouseButton == MouseRightButton or mouseButton == MouseLeftButton) then
Game.use(tile:getTopUseThing())
return true
elseif keyboardModifiers == KeyboardAltModifier and (mouseButton == MouseRightButton or mouseButton == MouseLeftButton) then
Game.attack(tile:getTopCreature())
return true
end end
end end