public static bool CalculateLunarTravelPath(MySpawnGroupDefinition spawnGroup, Vector3D startCoords, out Vector3D startPathCoords, out Vector3D endPathCoords)
        {
            startPathCoords = Vector3D.Zero;
            endPathCoords   = Vector3D.Zero;
            SpawnResources.RefreshEntityLists();
            MyPlanet planet = SpawnResources.GetNearestPlanet(startCoords);

            if (planet == null)
            {
                return(false);
            }

            var planetEntity = planet as IMyEntity;

            for (int i = 0; i < Settings.SpaceCargoShips.MaxSpawnAttempts; i++)
            {
                var spawnAltitude = (double)SpawnResources.rnd.Next((int)Settings.SpaceCargoShips.MinLunarSpawnHeight, (int)Settings.SpaceCargoShips.MaxLunarSpawnHeight);
                var abovePlayer   = SpawnResources.CreateDirectionAndTarget(planetEntity.GetPosition(), startCoords, startCoords, spawnAltitude);
                var midpointDist  = (double)SpawnResources.rnd.Next((int)Settings.SpaceCargoShips.MinPathDistanceFromPlayer, (int)Settings.SpaceCargoShips.MaxPathDistanceFromPlayer);
                var pathMidpoint  = SpawnResources.GetRandomCompassDirection(abovePlayer, planet) * midpointDist + abovePlayer;
                var pathDist      = (double)SpawnResources.rnd.Next((int)Settings.SpaceCargoShips.MinPathDistance, (int)Settings.SpaceCargoShips.MaxPathDistance);
                var pathDir       = SpawnResources.GetRandomCompassDirection(abovePlayer, planet);
                var pathHalfDist  = pathDist / 2;

                var tempPathStart = pathDir * pathHalfDist + pathMidpoint;
                pathDir = pathDir * -1;
                var tempPathEnd = pathDir * pathHalfDist + pathMidpoint;

                bool badPath = false;

                IHitInfo hitInfo = null;

                if (MyAPIGateway.Physics.CastLongRay(tempPathStart, tempPathEnd, out hitInfo, true) == true)
                {
                    continue;
                }


                foreach (var entity in SpawnResources.EntityList)
                {
                    if (Vector3D.Distance(tempPathStart, entity.GetPosition()) < Settings.SpaceCargoShips.MinSpawnDistFromEntities)
                    {
                        badPath = true;
                        break;
                    }
                }

                if (badPath == true)
                {
                    continue;
                }

                var upDir      = Vector3D.CalculatePerpendicularVector(pathDir);
                var pathMatrix = MatrixD.CreateWorld(tempPathStart, pathDir, upDir);

                foreach (var prefab in spawnGroup.Prefabs)
                {
                    double stepDistance    = 0;
                    var    tempPrefabStart = Vector3D.Transform((Vector3D)prefab.Position, pathMatrix);

                    while (stepDistance < pathDist)
                    {
                        stepDistance += Settings.SpaceCargoShips.PathCheckStep;
                        var pathCheckCoords = pathDir * stepDistance + tempPrefabStart;

                        if (SpawnResources.IsPositionInSafeZone(pathCheckCoords) == true || SpawnResources.IsPositionInGravity(pathCheckCoords, planet) == true)
                        {
                            badPath = true;
                            break;
                        }
                    }

                    if (badPath == true)
                    {
                        break;
                    }
                }

                if (badPath == true)
                {
                    continue;
                }

                startPathCoords = tempPathStart;
                endPathCoords   = tempPathEnd;

                return(true);
            }

            return(false);
        }