mirror of
https://github.com/edubart/otclient.git
synced 2025-04-29 17:19:20 +02:00
Fix for moving creatures/items far out of reach
Fix to https://github.com/edubart/otclient/issues/1055
This commit is contained in:
parent
11b006c356
commit
656dff45f1
@ -30,16 +30,30 @@ function UIGameMap:onDragLeave(droppedWidget, mousePos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function UIGameMap:onDrop(widget, mousePos)
|
function UIGameMap:onDrop(widget, mousePos)
|
||||||
if not self:canAcceptDrop(widget, mousePos) then return false end
|
if not self:canAcceptDrop(widget, mousePos) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local tile = self:getTile(mousePos)
|
local tile = self:getTile(mousePos)
|
||||||
if not tile then return false end
|
if not tile then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local thing = widget.currentDragThing
|
local thing = widget.currentDragThing
|
||||||
local toPos = tile:getPosition()
|
|
||||||
|
|
||||||
local thingPos = thing:getPosition()
|
local thingPos = thing:getPosition()
|
||||||
if thingPos.x == toPos.x and thingPos.y == toPos.y and thingPos.z == toPos.z then return false end
|
if not thingPos then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local thingTile = thing:getTile()
|
||||||
|
if thingPos.x ~= 65535 and not thingTile then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local toPos = tile:getPosition()
|
||||||
|
if thingPos.x == toPos.x and thingPos.y == toPos.y and thingPos.z == toPos.z then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if thing:isItem() and thing:getCount() > 1 then
|
if thing:isItem() and thing:getCount() > 1 then
|
||||||
modules.game_interface.moveStackableItem(thing, toPos)
|
modules.game_interface.moveStackableItem(thing, toPos)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user