Page MenuHomeFeedback Tracker

InventoryUI does not update correctly if target storage is full
Closed, ResolvedPublic

Description

While working a bit on inventory-related systems for one of my game modes I discovered an inventory UI script case that is not covered. If you drag and drop an item to a target storage, but that does not have enough space for it and it ends up in a different storage the UI code still only updates the storage you originally dragged and dropped it to. This causes a temporary desync of the inventory menu until all other storage (including the one the item really ended up in) are refreshed. You can see this in action in the video I attached.

Here is the cause of the problem:
SCR_InventoryMenuUI::MoveItemToStorageSlot

...
m_pCallBack.m_pStorageTo = m_pFocusedSlotUI.GetStorageUI();
...

SCR_InvCallBack::OnComplete

if ( m_pStorageTo )
{
    if ( m_pMenu )
    {
        if ( m_pStorageTo == m_pMenu.GetStorageList() )
        {
            m_pMenu.ShowStoragesList();
            m_pMenu.ShowAllStoragesInList();
        }
        else
        {
            m_pStorageTo.Refresh(); // <<<<<<<<<<<<< only the target storage is refreshed, but that one is NOT the one the item ended up in
        }
    }
}

As for a proposed fix, I have a vague idea of maybe setting "current callback" via a static field that is set before the operation is started. Then the SCR_InventoryStorageManagerComponent::OnItemAdded will trigger and set the m_pStorageTo to the correct storage for the storageOwner parameter. That way the target storage that really did receive the item is updated. Probably not the best solution though, but that I leave to the inventory scripter ;)

Details

Severity
Major
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General

Event Timeline

Arkensor created this task.Sep 11 2022, 5:21 PM
Geez changed the task status from New to Awaiting internal Testing.Sep 12 2022, 12:04 AM
Geez closed this task as Resolved.Jun 21 2023, 12:19 PM
Geez claimed this task.