add target cursor

master
Eduardo Bart 13 years ago
parent 34af633b47
commit 8db565f456

@ -19,3 +19,4 @@ Module
require 'effects' require 'effects'
require 'settings' require 'settings'
require 'hotkeys' require 'hotkeys'
require 'cursor'

@ -0,0 +1,7 @@
function setTargetCursor()
g_window.setMouseCursor('/core_styles/icons/targetcursor.png')
end
function restoreCursor()
g_window.restoreMouseCursor()
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

@ -2,18 +2,18 @@
-- public functions -- public functions
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() local selectedThing = Game.getSelectedThing()
if mouseButton == MouseRightButton and selectedThing then if mouseButton == MouseRightButton and selectedThing then
Game.setSelectedThing(nil) Game.setSelectedThing(nil)
return true return true
end end
if autoWalk and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton and not Game.getSelectedThing() then 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 mouseButton == MouseLeftButton and selectedThing then
Game.useWith(Game.getSelectedThing(), useThing) Game.useWith(Game.getSelectedThing(), useThing)
@ -31,7 +31,7 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
print "open" print "open"
elseif useThing:isMultiUse() then elseif useThing:isMultiUse() then
Game.setSelectedThing(useThing) Game.setSelectedThing(useThing)
-- todo change cursor setTargetCursor()
else else
Game.use(useThing) Game.use(useThing)
end end
@ -44,7 +44,7 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
if mouseButton == MouseLeftButton and selectedThing then if mouseButton == MouseLeftButton and selectedThing then
Game.useWith(Game.getSelectedThing(), multiUseThing) Game.useWith(Game.getSelectedThing(), multiUseThing)
Game.setSelectedThing(nil) Game.setSelectedThing(nil)
-- restore cursor restoreCursor()
return true return true
elseif multiUseThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then elseif multiUseThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
if multiUseThing:asCreature() then if multiUseThing:asCreature() then
@ -53,7 +53,7 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
print "open" print "open"
elseif multiUseThing:isMultiUse() then elseif multiUseThing:isMultiUse() then
Game.setSelectedThing(multiUseThing) Game.setSelectedThing(multiUseThing)
-- todo change cursor setTargetCursor()
else else
Game.use(useThing) Game.use(useThing)
end end
@ -69,14 +69,14 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
return true return true
end end
end end
return false return false
end end
function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing) function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
local menu = createWidget('PopupMenu') local menu = createWidget('PopupMenu')
if lookThing then if lookThing then
menu:addOption('Look', function() Game.look(lookThing) end) menu:addOption('Look', function() Game.look(lookThing) end)
end end
@ -88,32 +88,32 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
menu:addOption('Open', function() print('open') end) menu:addOption('Open', function() print('open') end)
else else
if useThing:isMultiUse() then if useThing:isMultiUse() then
-- todo change cursor setTargetCursor()
menu:addOption('Use with ...', function() Game.setSelectedThing(useThing) end) menu:addOption('Use with ...', function() Game.setSelectedThing(useThing) end)
else else
menu:addOption('Use', function() Game.use(useThing) end) menu:addOption('Use', function() Game.use(useThing) end)
end end
end end
if useThing:isRotateable() then if useThing:isRotateable() then
menu:addOption('Rotate', function() Game.rotate(useThing) end) menu:addOption('Rotate', function() Game.rotate(useThing) end)
end end
end end
if lookThing and not lookThing:asCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then if lookThing and not lookThing:asCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then
menu:addSeparator() menu:addSeparator()
menu:addOption('Trade with ...', function() print('trade with') end) menu:addOption('Trade with ...', function() print('trade with') end)
end end
-- check for move up -- check for move up
if creatureThing then if creatureThing then
menu:addSeparator() menu:addSeparator()
if creatureThing:asLocalPlayer() then if creatureThing:asLocalPlayer() then
menu:addOption('Set Outfit', function() Game.openOutfitWindow() end) menu:addOption('Set Outfit', function() Game.openOutfitWindow() end)
if creatureThing:asPlayer():isPartyMember() --[[and not fighting]] then if creatureThing:asPlayer():isPartyMember() --[[and not fighting]] then
if creatureThing:asPlayer():isPartyLeader() then if creatureThing:asPlayer():isPartyLeader() then
if creatureThing:asPlayer():isPartySharedExperienceActive() then if creatureThing:asPlayer():isPartySharedExperienceActive() then
@ -124,7 +124,7 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
end end
menu:addOption('Leave Party', function() Game.partyLeave() end) menu:addOption('Leave Party', function() Game.partyLeave() end)
end end
else else
local localPlayer = Game.getLocalPlayer() local localPlayer = Game.getLocalPlayer()
if localPlayer then if localPlayer then
@ -133,22 +133,22 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
else else
menu:addOption('Stop Attack', function() Game.cancelAttack() end) menu:addOption('Stop Attack', function() Game.cancelAttack() end)
end end
if localPlayer:getFollowingCreature() ~= creatureThing then if localPlayer:getFollowingCreature() ~= creatureThing then
menu:addOption('Follow', function() Game.follow(creatureThing) end) menu:addOption('Follow', function() Game.follow(creatureThing) end)
else else
menu:addOption('Stop Follow', function() Game.cancelFollow() end) menu:addOption('Stop Follow', function() Game.cancelFollow() end)
end end
if creatureThing:asPlayer() then if creatureThing:asPlayer() then
menu:addSeparator() menu:addSeparator()
menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end) menu:addOption('Message to ' .. creatureThing:getName(), function() print('message') end)
menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end) menu:addOption('Add to VIP list', function() Game.addVip(creatureThing:getName()) end)
menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end) menu:addOption('Ignore ' .. creatureThing:getName(), function() print('ignore') end)
local localPlayerShield = localPlayer:asCreature():getShield() local localPlayerShield = localPlayer:asCreature():getShield()
local creatureShield = creatureThing:getShield() local creatureShield = creatureThing:getShield()
if localPlayerShield == ShieldNone or localPlayerShield == ShieldWhiteBlue then if localPlayerShield == ShieldNone or localPlayerShield == ShieldWhiteBlue then
if creatureShield == ShieldWhiteYellow then if creatureShield == ShieldWhiteYellow then
menu:addOption('Join ' .. creatureThing:getName() .. '\'s Party', function() Game.partyJoin(creatureThing:getId()) end) menu:addOption('Join ' .. creatureThing:getName() .. '\'s Party', function() Game.partyJoin(creatureThing:getId()) end)
@ -174,8 +174,8 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
menu:addSeparator() menu:addSeparator()
menu:addOption('Copy Name', function() g_window.setClipboardText(creatureThing:getName()) end) menu:addOption('Copy Name', function() g_window.setClipboardText(creatureThing:getName()) end)
end end
menu:display(menuPosition) menu:display(menuPosition)
end end

Loading…
Cancel
Save