otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.6k stars 1.06k forks source link

doRelocate(pos, posTo) #300

Closed andypsylon closed 10 years ago

andypsylon commented 10 years ago

doRelocate function relocate NOmovable items too.

if (!it.isGroundTile() && !it.alwaysOnTop && !it.isMagicField() && !it.isDoor()) {
    g_game.internalTeleport(item, toPos, false, FLAG_IGNORENOTMOVEABLE);
dalkon commented 10 years ago
local item = Item(uid)
item:moveTo(position)
andypsylon commented 10 years ago

for all movable items on that position? i thing not :-1:

dalkon commented 10 years ago
local tile = Tile(oldPosition)
local items = tile:getTopDownItems()
for i = 1, #items do
    local item = items[i]
    item:moveTo(newPosition)
end

Can't you even try to make it yourself?

andypsylon commented 10 years ago

i can :) I mean, it's not a good solution! but thanks for the desire to help. Function "doRelocate" is well written? or i need to add ~"!it.isMovable()"? and add new Pull Request

PrinterLUA commented 10 years ago

Try this? function doRelocate(pos, toPos) pos.stackpos = 1 while getThingfromPos(pos).uid > 0 do doTeleportThing(getThingfromPos(pos).uid, toPos) pos.stackpos = pos.stackpos + 1 end end

andypsylon commented 10 years ago

Sorry for my bad Englisch :) but: I can lua very well.. good enough. That what i need is function in luascript.cpp I thing no one need doRelocate function for no movable items. And IF than maybe function with true/false option for with/without movable items.

marksamman commented 10 years ago

This is how it works in OpenTibia server, so we won't change the behavior. You can do like @dalkon said for more flexibility (the overhead for doing this isn't significant, so if this is bothering you, you should do it).

andypsylon commented 10 years ago

Thanks for the explanation :+1: