public static bool CheckGridBlocksForAutopilot(IMyCubeGrid grid) { var blockList = new List <IMySlimBlock>(); grid.GetBlocks(blockList, x => x.FatBlock != null); bool hasAutopilot = false; foreach (var block in blockList.Where(x => x.FatBlock as IMyRemoteControl != null)) { var remote = block.FatBlock as IMyRemoteControl; if (remote.IsAutoPilotEnabled == true) { Logger.AddMsg("Cargo Ship Has Autopilot: " + grid.CustomName, true); hasAutopilot = true; break; } if (string.IsNullOrWhiteSpace(remote.Name) == true) { MyVisualScriptLogicProvider.SetName(remote.EntityId, remote.EntityId.ToString()); } if (string.IsNullOrWhiteSpace(MyVisualScriptLogicProvider.DroneGetCurrentAIBehavior(remote.Name)) == false) { Logger.AddMsg("Cargo Ship Has Behavior: " + grid.CustomName, true); hasAutopilot = true; break; } if (remote.EnabledDamping == true) { Logger.AddMsg("Cargo Ship Has Dampeners: " + grid.CustomName, true); hasAutopilot = true; break; } } if (hasAutopilot == true) { NoLongerMonitorGrids.Add(grid); return(false); } return(true); }