mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
Fix issue #77 and improve findPath
This commit is contained in:
@@ -405,7 +405,7 @@ function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, u
|
||||
end
|
||||
|
||||
if autoWalkPos and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton then
|
||||
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), autoWalkPos, 127)
|
||||
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), autoWalkPos, 127, PathFindFlags.AllowNullTiles)
|
||||
if #dirs == 0 then
|
||||
modules.game_textmessage.displayStatusMessage(tr('There is no way.'))
|
||||
return true
|
||||
|
@@ -160,9 +160,9 @@ function onMinimapMouseRelease(self, mousePosition, mouseButton)
|
||||
navigating = false
|
||||
return
|
||||
end
|
||||
local tile = self:getTile(mousePosition)
|
||||
if tile and mouseButton == MouseLeftButton and self:isPressed() then
|
||||
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), tile:getPosition(), 127)
|
||||
local pos = self:getPosition(mousePosition)
|
||||
if pos and mouseButton == MouseLeftButton and self:isPressed() then
|
||||
local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), pos, 127, PathFindFlags.AllowNullTiles)
|
||||
if #dirs == 0 then
|
||||
modules.game_textmessage.displayStatusMessage(tr('There is no way.'))
|
||||
return true
|
||||
|
@@ -156,4 +156,19 @@ OsTypes = {
|
||||
OtclientMac = 12
|
||||
}
|
||||
|
||||
PathFindResults = {
|
||||
Ok = 0,
|
||||
Position = 1,
|
||||
Impossipble = 2,
|
||||
TooFar = 3,
|
||||
NoWay = 4
|
||||
}
|
||||
|
||||
PathFindFlags = {
|
||||
AllowNullTiles = 1,
|
||||
AllowCreatures = 2,
|
||||
AllowNonPathable = 4,
|
||||
AllowNonWalkable = 8
|
||||
}
|
||||
|
||||
-- @}
|
||||
|
Reference in New Issue
Block a user