[1.188.105] You can put negative inventory amount in containers using PBs

LordTylus shared this bug 11 months ago
Solved

Hello there,

today on our server we stumbled upon a player using a rather interesting kind of script in his PB. I was able to verify it on SP as well:

This script uses a "ContainerX" takes the first Item it finds and puts the number passed as argument as negative amount in the container.

This negative amount cannot be changed in anyway and the whole container starts to behave a bit weird.

So the bug is that its possible to put in a negative amount of Items in the container. With a negative amount of for example 10,000,000 platinum ingots there is enough negative mass to completely overfill a container.

See attached Screenshot:

70f5b5c6c88cd19bde33475afa7b0404

This shows 2 small cargo containers on a small grid ship.

On the right we have 26,6k platinum ingots that a small container can hold on 10x inventory.

On the left we have -10,000,000 platinum ingots that allows to easily put in 100k more ingots and steelplates. As you can see there is still negative mass and volume available to put more in.

Luckily the ships mass does not get reduced as it seems to ignore negative masses. So ship mass seems to be calculated differently.

See the Script below.

IMyCargoContainer XC;

public Program()
{
    XC = GridTerminalSystem.GetBlockWithName("ContainerX") as IMyCargoContainer;
}

public void Main(string argument)
{
    int Amount = Convert.ToInt32(argument);
    CreateAntimatter(Amount);
}

public void CreateAntimatter(int Amount)
{

    IMyInventory InvR = XC.GetInventory();
    List<IMyInventoryItem> ItemsR = InvR.GetItems();
    IMyInventoryItem ItemR = ItemsR[0];
    InvR.TransferItemFrom(InvR, 0, 1, true, -Amount);

}

Comments (3)

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

photo
2

The negative stack of items can be moved to personal inventory as well. This makes it so you can carry massive amounts of items on your person.

photo
2

Hi,

indeed thats probably the main purpose of the script. No idea why I didnt think about it sooner. With limited welder speed its faster to just put everything in your suit and weld it up using an elite welder.

photo
photo
1

Hello, Engineer!


We were not able reproduce your issue. Does this problem still persist for you?


Thank you.


Kind Regards

Keen Software House: QA Department

photo
1

Hello,


The 189 or 190 Update did two things.


1. it broke the script above so that it no longer compiles.

2. It seems to have fixed the issue when the Inventory Items were Reworked.


So you can mark this issue as closed!


Thank You :-)))


Verified it using the updated Script

IMyCargoContainer XC;

public Program()
{
    XC = GridTerminalSystem.GetBlockWithName("Container") as IMyCargoContainer;
}

public void Main(string argument)
{
    int Amount = Convert.ToInt32(argument);
    CreateAntimatter(Amount);
}

public void CreateAntimatter(int Amount)
{

    IMyInventory InvR = XC.GetInventory();
    
    List<MyInventoryItem> ItemsR = new List<MyInventoryItem>();
    InvR.GetItems(ItemsR);

    MyInventoryItem ItemR = ItemsR[0];
    InvR.TransferItemFrom(InvR, 0, 1, true, -Amount);

}

photo