Large grid small oxygen tank has empty BlockDefinition.SubtypeId

qqww shared this bug 24 days ago
Investigating

In the past I can use BlockDefinition.SubtypeId to determine is this tank is an oxygen tank or hydrogen tank in my in-game script in program block. but after recent update I found this subtypeid is empty for large grid small oxygen tank, make my script stop working. For small grid oxygen tank this id still exists. so, I think this could be a bug.

Replies (1)

photo
1

Hello Engineer,

Thank you for reaching out to us on the forum.

Could you please share the script where you’re encountering this issue? Also, please share the grid setup you’re using with this script. This information will help us investigate the issue further.

Kind regards,

Keen Software House: QA Department

photo
1

The grid is simple: one large grid oxygen tank and one hydrogen tank, and a program block and a battery. It use "Oxygen" keyword to determine if this tank is oxygen tank or hydrogen tank. after that, set tank to Stockpile.


Sorry I don't know how to export game grid as file.


Code snippet is as below:


var isDocked = true;
var handleHydrogenTank = true;
var handleOxygenTank = true;

List<IMyGasTank> blocks = new List<IMyGasTank>();
GridTerminalSystem.GetBlocksOfType(blocks, b =>
    b.CubeGrid == Me.CubeGrid &&
    (
        (handleHydrogenTank && b.BlockDefinition.SubtypeId.IndexOf("Hydrogen", StringComparison.OrdinalIgnoreCase) >= 0) ||
        (handleOxygenTank && b.BlockDefinition.SubtypeId.IndexOf("Oxygen", StringComparison.OrdinalIgnoreCase) >= 0)
    )
);
foreach (var block in blocks)
{
     block.Stockpile = isDocked;
}

photo
Leave a Comment
 
Attach a file