public static void ProceedEntityAction(MyEntity entity, EntityListAction action) { MyCubeGrid grid = entity as MyCubeGrid; if (grid == null) { ProceedEntityActionInternal(entity, action); } else { if (action == EntityListAction.Remove) { grid.DismountAllCockpits(); } ProceedEntityActionHierarchy(MyGridPhysicalHierarchy.Static.GetRoot(grid), action); } }