Page MenuHomeFeedback Tracker

Fix all InventoryTraversalType except LEVELORDER
Assigned, UrgentPublic

Description

playerBase.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, items);

Replace LEVELORDER by PREORDER, INORDER or POSTORDER and items will be returned multiple times, making the server freeze.
Discovered this by trying to save to json player's inventory when they die. Needed preorder to spawn them in order, but I'm forced to use levelorder that makes some item disappear if inventory if full or almost full.

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

See description

Event Timeline

Geez changed the task status from New to Need More Info.Nov 13 2019, 2:11 PM
Geez added a subscriber: Geez.

Hello GrosTon1.
Can you please provide us the easiest possible sequence of operations which will lead towards producing the issue?
Regards,
Geez

GrosTon1 added a comment.EditedNov 13 2019, 9:23 PM

Hello Geez,

modded class PlayerBase {

    ref array<string> stuff = new ref array<string>();

    override void EEKilled( Object killer )
    {	
        GetStuff(this);
        foreach(EntityAI i: stuff)
        {
            if (i) {
                Print(i)
            }
        }

	super.EEKilled( killer );
    }

    void GetStuff(EntityAI entity)
    {
        ref array<EntityAI> items = new ref array<EntityAI>();
        entity.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, items);

        foreach(EntityAI i: items)
        {
            if (i) {
                stuff.Add(i.GetType());
                GetStuff(i);
            }
        }
    }
}

With this modded PlayerBase server-side, kill yourself and check script.log, if you use InventoryTraversalType.PREORDER, InventoryTraversalType.INORDER or InventoryTraversalType.POSTORDER you will have delay between killing yourself and the escape menu showing (the server freeze I was talking about) and you will have way too much objects returned and printed, including SurvivorM/F_Whatever classes which isn't part of the inventory.

Let me know if you need anything more.

Geez changed the task status from Need More Info to Assigned.Nov 19 2019, 2:05 PM

Thank you.
The devs will take a look at this and I will let you know once there is more information available.
Regards,
Geez