Skip to content

Commit e588184

Browse files
authored
Merge pull request #18 from TorchAPI/patch-13
Follow logical (terminal) links when cleaning up grids.
2 parents 33c1d10 + bfd60ae commit e588184

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Essentials/Commands/CleanupModule.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ private IEnumerable<MyCubeGrid> ScanConditions(IReadOnlyList<string> args)
7070
}
7171
}
7272

73-
foreach (var grid in MyEntities.GetEntities().OfType<MyCubeGrid>())
73+
foreach (var group in MyCubeGridGroups.Static.Logical.Groups)
7474
{
75-
if (conditions.TrueForAll(func => func(grid)))
76-
yield return grid;
75+
if (group.Nodes.All(grid => conditions.TrueForAll(func => func(grid.NodeData))))
76+
foreach (var grid in group.Nodes)
77+
yield return grid.NodeData;
7778
}
7879
}
7980

0 commit comments

Comments
 (0)