|
|
@ -14,24 +14,13 @@ end
|
|
|
|
function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing, useThing, creatureThing, multiUseThing)
|
|
|
|
function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing, useThing, creatureThing, multiUseThing)
|
|
|
|
local keyboardModifiers = g_window.getKeyboardModifiers()
|
|
|
|
local keyboardModifiers = g_window.getKeyboardModifiers()
|
|
|
|
|
|
|
|
|
|
|
|
local selectedThing = Game.getSelectedThing()
|
|
|
|
if autoWalk and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton then
|
|
|
|
if mouseButton == MouseRightButton and selectedThing then
|
|
|
|
|
|
|
|
Game.setSelectedThing(nil)
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if autoWalk and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton and not Game.getSelectedThing() then
|
|
|
|
|
|
|
|
-- todo auto walk
|
|
|
|
-- todo auto walk
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if not Options.classicControl then
|
|
|
|
if not Options.classicControl then
|
|
|
|
if mouseButton == MouseLeftButton and selectedThing then
|
|
|
|
if keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
|
|
|
|
Game.useWith(Game.getSelectedThing(), multiUseThing)
|
|
|
|
|
|
|
|
Game.setSelectedThing(nil)
|
|
|
|
|
|
|
|
restoreCursor()
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
elseif keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
|
|
|
|
|
|
|
|
Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
elseif lookThing and keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
|
|
|
|
elseif lookThing and keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
|
|
|
@ -41,14 +30,17 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
|
|
|
|
if useThing:isContainer() then
|
|
|
|
if useThing:isContainer() then
|
|
|
|
if useThing:isInsideContainer() then
|
|
|
|
if useThing:isInsideContainer() then
|
|
|
|
Game.open(useThing, useThing:getContainerId())
|
|
|
|
Game.open(useThing, useThing:getContainerId())
|
|
|
|
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Game.open(useThing, Containers.getFreeContainerId())
|
|
|
|
Game.open(useThing, Containers.getFreeContainerId())
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif useThing:isMultiUse() then
|
|
|
|
elseif useThing:isMultiUse() then
|
|
|
|
Game.setSelectedThing(useThing)
|
|
|
|
Game.startUseWith(useThing)
|
|
|
|
setTargetCursor()
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Game.use(useThing)
|
|
|
|
Game.use(useThing)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
elseif creatureThing and keyboardModifiers == KeyboardAltModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
|
|
|
|
elseif creatureThing and keyboardModifiers == KeyboardAltModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
|
|
|
@ -56,23 +48,21 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if mouseButton == MouseLeftButton and selectedThing then
|
|
|
|
if multiUseThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
|
|
|
|
Game.useWith(Game.getSelectedThing(), multiUseThing)
|
|
|
|
|
|
|
|
Game.setSelectedThing(nil)
|
|
|
|
|
|
|
|
restoreCursor()
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
elseif multiUseThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
|
|
|
|
|
|
|
|
if multiUseThing:asCreature() then
|
|
|
|
if multiUseThing:asCreature() then
|
|
|
|
Game.attack(multiUseThing:asCreature())
|
|
|
|
Game.attack(multiUseThing:asCreature())
|
|
|
|
|
|
|
|
return true
|
|
|
|
elseif multiUseThing:isContainer() then
|
|
|
|
elseif multiUseThing:isContainer() then
|
|
|
|
if multiUseThing:isInsideContainer() then
|
|
|
|
if multiUseThing:isInsideContainer() then
|
|
|
|
Game.open(multiUseThing, multiUseThing:getContainerId())
|
|
|
|
Game.open(multiUseThing, multiUseThing:getContainerId())
|
|
|
|
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Game.open(multiUseThing, Containers.getFreeContainerId())
|
|
|
|
Game.open(multiUseThing, Containers.getFreeContainerId())
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif multiUseThing:isMultiUse() then
|
|
|
|
elseif multiUseThing:isMultiUse() then
|
|
|
|
Game.setSelectedThing(multiUseThing)
|
|
|
|
Game.startUseWith(multiUseThing)
|
|
|
|
setTargetCursor()
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Game.use(multiUseThing)
|
|
|
|
Game.use(multiUseThing)
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -110,7 +100,7 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if useThing:isMultiUse() then
|
|
|
|
if useThing:isMultiUse() then
|
|
|
|
menu:addOption('Use with ...', function() Game.setSelectedThing(useThing) setTargetCursor() end)
|
|
|
|
menu:addOption('Use with ...', function() Game.startUseWith(useThing) end)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
menu:addOption('Use', function() Game.use(useThing) end)
|
|
|
|
menu:addOption('Use', function() Game.use(useThing) end)
|
|
|
|
end
|
|
|
|
end
|
|
|
|