Summary
This is somewhat a followup to [Itemization] `ChangeInventoryEvent` is completely broken and unusable - #6 by Sprintermax (which seems to be fixed already as of v41.00).
Besides the inventory events being fixed as said above, other errors related to them still persists or was newly discovered. Bellow I will talk about some of them
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Scene Graph
Steps to Reproduce
- Listen for inventory or item component events (I’ve attached an example code that can help with this)
- Check how the events behave and the data/states of the simulation during them.
Expected Result
-
Events should fire after the action was done, not during or before them. (This is correct for the “add” events, but incorrect for the “remove” events).
-
“Sequential” events should be deterministic (ex. Unequip first then Remove from inv, never removing then unequiping later). The deterministic order should be enforced since not make sense “having a item equipped that is not on the inventory anymore” for example.
Observed Result
-
The “added” events from both inventories and item components are correctly fired after the addition finishes. But, the “removed” event is broken in different ways on both the item component or inventory events: Seems like gets fired before the change happens, causing wrong scene queries after listening for the event callbacks.
→ This causes confusions due to evaluation order and what to expect from the names and descriptions on the API, and causes unexpected/incorrect behavior when using the behaviors together with other gameplay logic. On these cases, it is behaving more as a “before inventory change event” than the expected “inventory changed event”. -
On some very rare cases (I was not able to find concrete repro steps), the “sequential” events are fired in wrong orders. (Item Removed called before Item Unequipped for example)
Platform(s)
Windows 11 / Verse (Server)
Upload an image
debug_events_item_component.verse (4.77 KB)
Additional Notes
As shown on the debug prints above, here is a more detailed analysis:
This is an example, when we drop an item entity from Hotbar Inventory to World (Simulation Entity):
Current Inventory = false(ok)Previous Inventory = weapon_hotbar_inv(ok, this was the part fixed on the FORT-1103347 forum post, it was “false” before v41)Current Parent Entity = weapon_hotbar_inv_entity(still broken/wrong, should be simulation entity since it was dropped, it is not on the hotbar anymore.)
And, some more detailed test results (Pickup/Add -> Equip -> Unequip -> Drop/Remove):
-ItemComponent.ChangeInventoryEvent/change_inventory_result:
- Is Correct when adding to inv
- Is Broken when removing from inv (as described above, wrongly has the previous parent entity instead of the expected current parent entity after the removal)
-ItemComponent.ChangeEquippedEvent/change_equipped_result: All Correct
-InventoryComponent.AddItemEvent/add_item_result: All Correct
-InventoryComponent.RemoveItemEvent/remove_item_result:
- Broken (Says no parent entity - Should it be simulation entity on this example, since It is being directly added to sim entity and not being “outside the scene” for any moment during the removal/change)
-InventoryComponent.EquipItemEvent/equip_item_result: All Correct
-InventoryComponent.UnequipItemEvent/unequip_item_result: All Correct
Note: I have not tested other checks, such as IsSimulating[], IsOnScene[], and from what I tested, the behavior is the same with both custom items made from scratch, custom weapons made from templates, or child prefab from existing fortnite weapons.
