Proper fix for autowalk lag issue

This commit is contained in:
BeniS
2013-02-13 18:05:08 +13:00
parent 725a16e38e
commit adc01ab9e3
2 changed files with 22 additions and 12 deletions

View File

@@ -65,6 +65,14 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
-- happens when clicking outside of map boundaries
if not autoWalkPos then return false end
local localPlayerPos = g_game.getLocalPlayer():getPosition()
if autoWalkPos.z ~= localPlayerPos.z then
local dz = autoWalkPos.z - localPlayerPos.z
autoWalkPos.x = autoWalkPos.x + dz
autoWalkPos.y = autoWalkPos.y + dz
autoWalkPos.z = localPlayerPos.z
end
local lookThing
local useThing
@@ -76,18 +84,6 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
lookThing = tile:getTopLookThing()
useThing = tile:getTopUseThing()
creatureThing = tile:getTopCreature()
if tile:isWalkable() then
local localPlayerPos = g_game.getLocalPlayer():getPosition()
if autoWalkPos.z ~= localPlayerPos.z then
local dz = autoWalkPos.z - localPlayerPos.z
autoWalkPos.x = autoWalkPos.x + dz
autoWalkPos.y = autoWalkPos.y + dz
autoWalkPos.z = localPlayerPos.z
end
else
autoWalkPos = nil
end
end
local ret = modules.game_interface.processMouseAction(mousePosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing)