[Itemization] `ChangeInventoryEvent` is completely broken and unusable

Summary

When using ItemComponent.ChangeInventoryEvent to detect inventory changes for that item, it is not behaving as it is supposed to, making the usage unstable in certain scenarios and even unusable in other specific cases.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Scene Graph

Steps to Reproduce

  1. Make a custom item prefab using this example item_component setup (Do the test with an item made from scratch and also with an custom item subtype based on an existing fortnite weapon prefab):
my_item_component<public> := class<final_super>(item_component) {

    var<private> InventoryItemEventSubscriptions<private> : ?cancelable = false

    OnSimulate<override>()<suspends>:void = {
        option{
            not InventoryItemEventSubscriptions?
            set InventoryItemEventSubscriptions = option{
                Self.ChangeInventoryEvent.Subscribe(OnInventoryChanged)
            }
        }
    }

    OnInventoryChanged<private>(ChangeInventoryResult:change_inventory_result):void = {
        Print("On Inventory Changed Event: " + ToDiagnostic(ChangeInventoryResult))
        Print("  ↪ Previous: " + ToDiagnostic(ChangeInventoryResult.PreviousInventory))
        Print("  ↪ Current: " + ToDiagnostic(ChangeInventoryResult.CurrentInventory))
    }
}
  1. Spawn the item in game
  2. Do actions such as picking it up and dropping repeatedly
    3.1 Also, do actions such as removing and reading to the world/scene (without messing with inventories)
  3. Observe the results printed on the logs

Expected Result

change_inventory_result should behave:

  1. correctly have the current AND previous inventory when applicable
  2. fire only on inventory related changes
  3. fire only a single time on each change that happened

Observed Result

change_inventory_result is currently behaving:

  1. the PreviousInventory is always empty making it useless. Ex. if you drop an item from inv to the ground, both the PreviousInventory and CurrentInventory will be false. (Previous expected to be the inventory from which it was dropped)
  2. It is firing every time on any scene changes, including adding/removing to scene. Behaving more like a “SceneChangedEvent” instead of a “ChangeInventoryEvent”.
  3. It is firing multiple times (probably delated to item 2 mentioned above). Sometimes even 3x or more.

Platform(s)

All (Verse/Server)

Upload an image

FORT-1103347 has been created and its status is ‘Unconfirmed’. This is now in a queue to be reproduced and confirmed.