Skip to content

Commit ec9199d

Browse files
authored
Re-exclude SRBs from grid integrity calcs (#1898)
1 parent 54902fa commit ec9199d

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • Gamemode Mods/Starcore_Sharetrack/Data/Scripts/ShipPoints/ShipTracking

Gamemode Mods/Starcore_Sharetrack/Data/Scripts/ShipPoints/ShipTracking/GridStats.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ namespace StarCore.ShareTrack.ShipTracking
1313
{
1414
internal class GridStats // TODO convert this to be event-driven. OnBlockPlace, etc. Keep a queue.
1515
{
16+
private readonly string[] _ignoredIntegrityBlocks = new[]
17+
{
18+
"SC_SRB"
19+
};
20+
1621
private readonly HashSet<IMyCubeBlock> _fatBlocks = new HashSet<IMyCubeBlock>();
1722

1823
private readonly HashSet<IMySlimBlock> _slimBlocks;
@@ -38,7 +43,7 @@ public GridStats(IMyCubeGrid grid)
3843

3944
foreach (var block in _slimBlocks)
4045
{
41-
if (block?.FatBlock != null)
46+
if (block?.FatBlock != null && !_ignoredIntegrityBlocks.Contains(block.BlockDefinition.Id.SubtypeName))
4247
{
4348
_fatBlocks.Add(block.FatBlock);
4449
GridIntegrity += block.Integrity;
@@ -72,11 +77,11 @@ public void UpdateAfterSim()
7277
{
7378
float tempGridInteg = 0;
7479

75-
foreach (var block in _slimBlocks)
80+
foreach (var block in _fatBlocks)
7681
{
77-
if (block.FatBlock != null) // Remove To Count All Blocks
82+
if (block != null && !_ignoredIntegrityBlocks.Contains(block.BlockDefinition.SubtypeName)) // Remove To Count All Blocks
7883
{
79-
tempGridInteg += block.Integrity;
84+
tempGridInteg += block.SlimBlock.Integrity;
8085
}
8186
}
8287

0 commit comments

Comments
 (0)