function onStepOut(creature, item, position, fromPosition)
local toPositionTile = Tile(position):getGround()
local fromPositionTile = Tile(fromPosition):getGround()
print(toPositionTile.itemid)
print(fromPositionTile.itemid)
print(position == fromPosition)
end
The values should be different if the origin and destination tiles are different.
The values are the same even if origin and destination tiles are different .
Latest commits.
The same logic is used for both stepIn and stepOut, but it seems this doesn't work for stepOut:
LuaScriptInterface::pushPosition(L, pos);
LuaScriptInterface::pushPosition(L, creature->getLastPosition());
The pos end up being the same.
Tagging @EvilHero90 as he has some recent experience with movements due to revscriptsys.
I think this problem has already been asked a while around aswell.
The problem is that in Tile::postRemoveNotification we push the tile the player is standing on right now -> g_moveEvents->onCreatureMove(creature, this, MOVE_EVENT_STEP_OUT); this <- is the tile.
So when we try to get the const Position& pos = tile->getPosition(); in uint32_t MoveEvents::onCreatureMove then it gives us the tile we are moving away from, so fromPosition and position are equal.
Edit: fixed in #2587
Fix commit had some issues and got reverted, this Lua change in the steps to reproduce might be a workaround?
function onStepOut(creature, item, position, fromPosition)
local toPositionTile = Tile(creature:getPosition()):getGround()
local fromPositionTile = Tile(position):getGround()
print(toPositionTile.itemid)
print(fromPositionTile.itemid)
print(creature:getPosition() == position)
end
It's actually missleading, if you see it for real onStepOut is rather an onSteppedOut that's why I still think that the missleading fromPosition should be renamed to nextPosition and pushes the according position to it, as I did in #2589
Most helpful comment
It's actually missleading, if you see it for real
onStepOutis rather anonSteppedOutthat's why I still think that the missleadingfromPositionshould be renamed tonextPositionand pushes the according position to it, as I did in #2589