From 656dff45f11ce3f4317bb2be68429bda59dcecd9 Mon Sep 17 00:00:00 2001 From: 4drik <4drik@users.noreply.github.com> Date: Wed, 20 Nov 2019 10:21:04 +0100 Subject: [PATCH] Fix for moving creatures/items far out of reach Fix to https://github.com/edubart/otclient/issues/1055 --- modules/game_interface/widgets/uigamemap.lua | 24 ++++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/modules/game_interface/widgets/uigamemap.lua b/modules/game_interface/widgets/uigamemap.lua index 04ce91ff..e5924a9d 100644 --- a/modules/game_interface/widgets/uigamemap.lua +++ b/modules/game_interface/widgets/uigamemap.lua @@ -30,16 +30,30 @@ function UIGameMap:onDragLeave(droppedWidget, mousePos) end 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) - if not tile then return false end + if not tile then + return false + end local thing = widget.currentDragThing - local toPos = tile: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 modules.game_interface.moveStackableItem(thing, toPos)