[1.194.082] IMyInventory::GetAcceptedItems() didn't work properly

DMOrigin shared this bug 4 years ago
Outdated

I have checked the list of accepted items for a normal container. For example a small cargo container for large grids. This container can store a Datapad. The item type is MyObjectBuilder_Datapad/Datapad.


If you use the following code:

public void Main(string argument, UpdateType updateSource)
{
    StringBuilder sb = new StringBuilder();

    List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
    GridTerminalSystem.GetBlocks(blocks);
    foreach(var block in blocks)
    {
        for (int inv = 0; inv < block.InventoryCount; inv++)
        {
            var inventory = block.GetInventory(inv);
            List<MyItemType> types = new List<MyItemType>();

            inventory.GetAcceptedItems(types);
            foreach(var type in types)
            {
                 sb.AppendLine($"{type}");
            }
        }
    }

    Me.CustomData = sb.ToString();
}
The item type MyObjectBuilder_Datapad/Datapad isn't part of the list. But it must be part of it, because you can place a Datapad into a cargo container. Place one Datapad into a cargo container and check the content of this cargo container you will find the Datapad.
List<MyInventoryItem> invItems = new List<MyInventoryItem>();
inventory.GetItems(invItems);
foreach(var item in invItems)
{
     sb.AppendLine($"{item.Type}");
}

Replies (1)

photo
1

Hello, Engineer!


Thank you for your feedback! Your topic has been added between considered issues.

Please keep voting for the issue as it will help us to identify the most serious bugs.


We really appreciate your patience.


Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file