Skip to content

fix bug where two players dropping items at the same location can't both pick them up

Logg requested to merge Loggy/openrsc:pickup-bug-fix into develop

There was a function called

public GroundItem getGroundItem(final int id, final Point location) {

which I've replaced with

public GroundItem getVisibleGroundItem(final int id, final Point location, final Player player) {

I found that all instances of the previous function were expecting a situation where the ground item interacted with was visible to the interacting player, but due to the fact that multiple players may have items that they own that aren't yet visible to the interacting player and that have the same item id, and exist at the same location, it would sometimes (of the list of items made available by for (final GroundItem o : getItemsInView()) {) choose the item that the interacting player requesting some action did not own, and then the logic would abort since that item is not visible, even though there did exist a visible item of that item id on that tile that the player did own that the player is attempting to interact with.

By filtering out the items invisible to the interacting player prior to returning the oldest item, we can ensure that players are able to interact with the visible item that they are legitimately able to interact with, even if it is not the oldest that exists on the server at that location at that time.

Resolves #3297 (closed) Resolves #3533 (closed)

Edited by Logg

Merge request reports