qbcore-framework / qb-inventory

Slot Based Inventory System Used With QB-Core :school_satchel:
GNU General Public License v3.0
50 stars 377 forks source link

fix(app): Prevent unique items dropping into void #376

Closed tom-osborne closed 1 year ago

tom-osborne commented 1 year ago

Description

Dropping a unique item onto a unique item in the first 5 slots would result in the item being transferred successfully to the same destination slot as it came from. i.e. if a unique item from slot 3 in player inventory was dropped onto a unique item in slot 1 (occupied slot) in secondary inventory, it would transfer to slot 3 of the secondary inventory (somewhat incorrectly - it should fail). However, if slot 3 was also occupied, then the item would end up into a void and disappear. A good demonstration can be seen here: https://github.com/qbcore-framework/qb-inventory/issues/308#issuecomment-1305512700

This PR resolves this issue, by adding a check to ensure the slot being dragged to is empty before transferring the item. If the slot is not empty, the transfer will not occur preventing the issue.

Fixes #308.

Checklist

tom-osborne commented 1 year ago

Works as intended https://github.com/qbcore-framework/qb-inventory/issues/308#issuecomment-1306714614