mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 15:26:49 +01:00
add target cursor
This commit is contained in:
@@ -19,3 +19,4 @@ Module
|
||||
require 'effects'
|
||||
require 'settings'
|
||||
require 'hotkeys'
|
||||
require 'cursor'
|
||||
|
||||
7
modules/core_lib/cursor.lua
Normal file
7
modules/core_lib/cursor.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
function setTargetCursor()
|
||||
g_window.setMouseCursor('/core_styles/icons/targetcursor.png')
|
||||
end
|
||||
|
||||
function restoreCursor()
|
||||
g_window.restoreMouseCursor()
|
||||
end
|
||||
BIN
modules/core_styles/icons/targetcursor.png
Normal file
BIN
modules/core_styles/icons/targetcursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 256 B |
@@ -31,7 +31,7 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
|
||||
print "open"
|
||||
elseif useThing:isMultiUse() then
|
||||
Game.setSelectedThing(useThing)
|
||||
-- todo change cursor
|
||||
setTargetCursor()
|
||||
else
|
||||
Game.use(useThing)
|
||||
end
|
||||
@@ -44,7 +44,7 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
|
||||
if mouseButton == MouseLeftButton and selectedThing then
|
||||
Game.useWith(Game.getSelectedThing(), multiUseThing)
|
||||
Game.setSelectedThing(nil)
|
||||
-- restore cursor
|
||||
restoreCursor()
|
||||
return true
|
||||
elseif multiUseThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
|
||||
if multiUseThing:asCreature() then
|
||||
@@ -53,7 +53,7 @@ function Game.processMouseAction(menuPosition, mouseButton, autoWalk, lookThing,
|
||||
print "open"
|
||||
elseif multiUseThing:isMultiUse() then
|
||||
Game.setSelectedThing(multiUseThing)
|
||||
-- todo change cursor
|
||||
setTargetCursor()
|
||||
else
|
||||
Game.use(useThing)
|
||||
end
|
||||
@@ -88,7 +88,7 @@ function Game.createThingMenu(menuPosition, lookThing, useThing, creatureThing)
|
||||
menu:addOption('Open', function() print('open') end)
|
||||
else
|
||||
if useThing:isMultiUse() then
|
||||
-- todo change cursor
|
||||
setTargetCursor()
|
||||
menu:addOption('Use with ...', function() Game.setSelectedThing(useThing) end)
|
||||
else
|
||||
menu:addOption('Use', function() Game.use(useThing) end)
|
||||
|
||||
Reference in New Issue
Block a user