forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

[Bug]: Closing door delete items on the ground

Open Feeltz opened this issue 1 year ago • 1 comments

By submitting this bug issue, you agree to the following.

  • [X] This is a bug in the software that resides in this repository, and not a support matter (use https://otland.net/forums/support.16/ for support)
  • [X] This issue is reproducible without changes to the C++ code in this repository
  • [X] This bug has not been resolved in master branch
  • [X] There is no existing issue for this bug already

Does this bug crash tfs?

no

Server Version

1.7 (Master), 1.4.x (Release)

Operation System

all (listed below)

OS Description

No response

Bug description

Auto closing door can delete item on the ground

Possible Pull Requests which are to blame

No response

Steps to reproduce

Best place to test it is on the real map is on Darashia Mino Tower obraz

  1. Stand on auto closing door, that points downwoards, and the mailbox has to be below you (y+1)
  2. put items on the ground, under your character
  3. step out north, to trigger auto-close door

Code to reproduce the issue: This part of the closing_door.lua is responsible for deleting items

local i, tileItem, tileCount = 1, true, tile:getThingCount()
while tileItem and i < tileCount do
        tileItem = tile:getThing(i)
        if tileItem and tileItem:getUniqueId() ~= item.uid and tileItem:getType():isMovable() then
	        tileItem:remove()
        else
	        i = i + 1
        end
end

https://github.com/otland/forgottenserver/blob/173ab186e0d218d69acff746a2a795f6dcb7b323/data/scripts/movements/closing_door.lua#L11

It can be corelated with this issue: https://github.com/otland/forgottenserver/issues/4467 partialy fixed in here https://github.com/otland/forgottenserver/pull/4468

Actual Behavior

Items disappear. If you die on door SQM, your corpse will disappear. The problem is if the mailbox (or other solid item) is south or east from door. It should not happen because normally you can throw items on the mailbox.

Expected Behavior

Items are moved on the top of the mailbox or pushed oposite way if instead of mailbox is something like wall.

Backtrace

No response

Feeltz avatar Nov 17 '24 09:11 Feeltz

Instead of remove, just move it.

https://github.com/otland/forgottenserver/blob/14ba662ad6d6ad2d7dc0439fc2350f816f4c11e2/data/scripts/movements/closing_door.lua#L25

tileItem:moveTo(newPosition)

Diego-OT avatar Nov 18 '24 04:11 Diego-OT