Beispiel #1
0
        public static bool IsWorkingGrid(this IMyCubeGrid Grid, bool AllowStations = true, bool AllowUnmanned = true, bool CheckForThrustersInAllDirections = false)
        {
            try
            {
                if (!Grid.InScene)
                {
                    return(false);
                }
                //if (Grid.IsTrash()) return false;
                if (!AllowStations && Grid.IsStatic)
                {
                    return(false);
                }
                if (!Grid.HasPower())
                {
                    return(false);
                }
                if (AllowUnmanned && !Grid.HasController())
                {
                    return(false);
                }
                if (!AllowUnmanned && !Grid.HasCockpit())
                {
                    return(false);
                }
                if (!Grid.IsStatic && !Grid.HasGyros())
                {
                    return(false);
                }
                if (!CheckForThrustersInAllDirections && !Grid.IsStatic && !Grid.HasAnyThrusters())
                {
                    return(false);
                }
                if (CheckForThrustersInAllDirections && !Grid.IsStatic && !Grid.HasThrustersInEveryDirection())
                {
                    return(false);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }