Exemplo n.º 1
0
 public FormationZone( Range incoming, int parentId )
 {
     Segments = new List<FormationSegment>
     {
         new FormationSegment(parentId, incoming)
     };
     ParentId = parentId;
     OurOrbits = new List<double>();
 }
Exemplo n.º 2
0
 public double PickInRange( Range incoming )
 {
     return ZonesOfInterest.PickInRange(incoming);
 }
Exemplo n.º 3
0
 //zones of interest functions - both to see if it's initated and to create it.
 //init formulas
 //passthrough functions
 public void CreateForbiddenZone( Range incoming, int primary, int secondary )
 {
     ZonesOfInterest.CreateForbiddenZone(incoming, primary, secondary);
 }
Exemplo n.º 4
0
 public double VerifyRange( Range incoming )
 {
     return ZonesOfInterest.VerifyRange(incoming);
 }
Exemplo n.º 5
0
        public void CreateCleanZones( Range fullCreationRange )
        {
            UpdateCreationRange(fullCreationRange);
            var currentPos = CreationRange.LowerBound;

            //default values
            var ownershipFlag = StarId;
            var orbitDesc = StarId;

            if (ForbiddenZones.Count == 0)
            {
                FormationZones.Add(new CleanZone(CreationRange, StarId, StarId));
                return;
            }

            foreach (var o in ForbiddenZones)
            {
                if (currentPos < o.LowerBound && CreationRange.UpperBound <= o.LowerBound)
                {
                    //CASE 1: Both the current position and outer radius are before the forbidden zone
                    // This clean zone is from currentPos to the outer radius. Is the end of our generation
                    FormationZones.Add(new CleanZone(currentPos, CreationRange.UpperBound, StarId, StarId));
                    return;
                }

                if (currentPos < o.LowerBound && CreationRange.UpperBound > o.UpperBound)
                {
                    //CASE 2: The current position is below the forbidden zone, and the outer radius is beyond it
                    // This clean zone is from current position to the lower bound of the forbidden zone
                    // We then move the pointer to the end of the higher bound.
                    FormationZones.Add(new CleanZone(currentPos, o.LowerBound, ownershipFlag, orbitDesc));
                    if (o.PrimaryStar != StarId)
                    {
                        return; //return now if you lose primary status.
                    }
                    ownershipFlag = o.PrimaryStar;
                    orbitDesc = GetNewOrbitDesc(orbitDesc, o.PrimaryStar, o.SecondaryStar);
                    //OwnershipFlag = 99;
                    currentPos = o.UpperBound;
                }

                if (currentPos < o.LowerBound && o.LowerBound < CreationRange.UpperBound && CreationRange.UpperBound <= o.UpperBound)
                {
                    //CASE 3: The current position is below the forbidden zone, and the outer radius is within it.
                    // The clean zone is from the current position to the lower bound of the forbidden zone
                    // We then return, no more clear zones.
                    FormationZones.Add(new CleanZone(currentPos, o.LowerBound, ownershipFlag, orbitDesc));
                    return;
                }

                if (!( currentPos >= o.LowerBound ) || !( o.UpperBound < CreationRange.UpperBound ))
                {
                    continue;
                }
                //CASE 4: The current position is within a forbidden zone, and the outer radius is beyond it.
                //Move forward the pointers, but don't add a clean zone
                currentPos = o.UpperBound;
                ownershipFlag = o.PrimaryStar;
                orbitDesc = GetNewOrbitDesc(orbitDesc, o.PrimaryStar, o.SecondaryStar);
                //OwnershipFlag = 99;
            }

            if (!( currentPos < CreationRange.UpperBound ))
            {
                return;
            }
            // CASE 5: current position is under the upperBound. Add it, and return.
            FormationZones.Add(new CleanZone(currentPos, CreationRange.UpperBound, ownershipFlag, orbitDesc));
        }
Exemplo n.º 6
0
        //check -range- function.
        public double VerifyRange( Range checkRange )
        {
            double rangeAvail = 1;
            var currentPos = checkRange.LowerBound;

            //escape hatch for this condition

            if (ForbiddenZones.Count == 0)
            {
                return 1;
            }

            //Which is.. wat? Still, fixed.
            if (FormationZones.Any(o => checkRange.LowerBound >= o.LowerBound && checkRange.UpperBound <= o.UpperBound))
            {
                return 1;
            }

            foreach (var o in ForbiddenZones)
            {
                //CASE 1: The forbidden zone is between here and the end
                if (( currentPos < checkRange.UpperBound ) && ( currentPos < o.LowerBound ) && ( o.UpperBound <= checkRange.UpperBound ))
                {
                    rangeAvail = rangeAvail - ( o.UpperBound - o.LowerBound ) / checkRange.Length;
                    if (Math.Abs(rangeAvail) < 0)
                    {
                        return rangeAvail;
                    }

                    currentPos = o.UpperBound;
                }

                //CASE 2: This is within a forbidden zone
                if (( checkRange.LowerBound >= o.LowerBound ) && ( checkRange.UpperBound <= o.UpperBound ))
                {
                    return 0;
                }

                //CASE 3: Current Position is within a forbidden zone and it cotnains the end.
                if (( currentPos < checkRange.UpperBound ) && ( currentPos > o.LowerBound ) && ( checkRange.UpperBound <= o.UpperBound ))
                {
                    rangeAvail = rangeAvail - ( o.UpperBound - currentPos ) / checkRange.Length;
                    if (Math.Abs(rangeAvail) < 0)
                    {
                        return rangeAvail;
                    }

                    currentPos = checkRange.UpperBound;
                }

                //CASE 4: Current Position is within a forbidden zone and it does not contain the end.
                if (( currentPos < checkRange.UpperBound ) && ( currentPos > o.LowerBound ) && ( checkRange.UpperBound > o.UpperBound ))
                {
                    rangeAvail = rangeAvail - ( o.UpperBound - currentPos ) / checkRange.Length;
                    if (rangeAvail == 0)
                    {
                        return rangeAvail;
                    }

                    currentPos = o.UpperBound;
                }

                //CASE 5: The end is within a forbidden zone but the current position is not
                if (!( currentPos < checkRange.UpperBound ) || !( currentPos < o.LowerBound ) || !( checkRange.UpperBound >= o.LowerBound ) || !( checkRange.UpperBound < o.UpperBound ))
                {
                    continue;
                }
                rangeAvail = rangeAvail - ( checkRange.UpperBound - o.LowerBound ) / checkRange.Length;
                if (rangeAvail == 0)
                {
                    return rangeAvail;
                }

                currentPos = checkRange.UpperBound;

                //CASE 6: No IF condition if the forbidden zone is entirely to the left or right.
            }

            if (rangeAvail >= 0 && rangeAvail <= 1)
            {
                return rangeAvail;
            }
            throw new Exception("RangeAvail is " + rangeAvail + " and exceeds 0-100%.");
        }
Exemplo n.º 7
0
 //member functions
 public void UpdateCreationRange( Range creationRange )
 {
     CreationRange = creationRange;
 }
Exemplo n.º 8
0
        //range pick equations
        public double PickInRange( Range validRange )
        {
            var rangeIncrement = Math.Pow(10, 6);
            var currentPos = validRange.LowerBound;
            do
            {
                if (!IsWithinForbiddenZone(currentPos))
                {
                    return currentPos;
                }
                currentPos += validRange.Length / rangeIncrement;
            }
            while (currentPos <= validRange.UpperBound);

            return Novalidorbit;
        }
Exemplo n.º 9
0
 public void CreateForbiddenZone( Range forbiddenRange, int primary, int secondary )
 {
     ForbiddenZones.Add(new ForbiddenZone(forbiddenRange, primary, secondary));
 }
Exemplo n.º 10
0
        public StarSystem CreateNewSystem()
        {
            OurSystem.SysName = LibStarGen.GenRandomSysName(OptionCont.SysNamePrefix, VelvetBag);
            OurSystem.SysAge = LibStarGen.GenSystemAge(VelvetBag);
            LibStarGen.CreateStars(VelvetBag, OurSystem);
            //---------------------
            //generate the planets!
            var totalOrbCount = 0; //total orbital count

            //first off, master loop.
            foreach (var star in OurSystem.SysStars)
            {
                //draw up forbidden zones.
                if (!star.TestInitlizationZones())
                {
                    star.InitalizeZonesOfInterest();
                }
                for (var i = 1; i < OurSystem.SysStars.Count; i++)
                {
                    Range temp;
                    if (OurSystem.SysStars[i].ParentId == star.SelfId)
                    {
                        temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                        star.CreateForbiddenZone(temp, star.SelfId, OurSystem.SysStars[i].SelfId);
                    }
                    if (OurSystem.SysStars[i].SelfId != star.SelfId)
                    {
                        continue;
                    }
                    temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                    star.CreateForbiddenZone(temp, star.ParentId, star.SelfId);
                }

                star.SortForbidden();
                star.CreateCleanZones();
                //gas giant flag
                //                LibStarGen.gasGiantFlag(this.OurSystem.sysStars[currStar], VelvetBag.gurpsRoll());

                var placeHolder = new Satellite(0, 0, 0, 0);
                int ownership;
                if (star.GasGiantFlag != Star.GasgiantNone)
                {
                    double rangeAvail = 0, lowerBound = 0, diffRange = 0;
                    var spawnRange = new Range(0, 1);

                    //get range availability and spawn range

                    //CONVENTIONAL
                    if (star.GasGiantFlag == Star.GasgiantConventional)
                    {
                        rangeAvail = star.CheckConRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * 1;
                        diffRange = Star.SnowLine(star.InitLumin) * 1.5 - lowerBound;
                        spawnRange = star.GetConventionalRange();
                    }

                    //ECCENTRIC
                    if (star.GasGiantFlag == Star.GasgiantEccentric)
                    {
                        rangeAvail = star.CheckEccRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * .125;
                        diffRange = Star.SnowLine(star.InitLumin) * .75 - lowerBound;
                        spawnRange = star.GetEccentricRange();
                    }

                    //EPISTELLAR
                    if (star.GasGiantFlag == Star.GasgiantEpistellar)
                    {
                        rangeAvail = star.CheckEpiRange();
                        lowerBound = Star.InnerRadius(star.InitLumin, star.InitMass) * .1;
                        diffRange = Star.InnerRadius(star.InitLumin, star.InitMass) * 1.8 - lowerBound;
                        spawnRange = star.GetEpistellarRange();
                    }

                    int roll;
                    double orbit;
                    if (rangeAvail >= .25)
                    {
                        do
                        {
                            orbit = VelvetBag.RollRange(lowerBound, diffRange);
                        }
                        while (!star.VerifyCleanOrbit(orbit));

                        ownership = star.GetOwnership(orbit);

                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }

                    if (rangeAvail >= .005 && rangeAvail < .25)
                    {
                        orbit = star.PickInRange(spawnRange);
                        ownership = star.GetOwnership(orbit);
                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }
                }

                //now we've determined our placeholdr, let's start working on our orbitals.

                double currOrbit = Star.InnerRadius(star.InitLumin, star.InitMass), nextOrbit;
                const double distance = .15;

                //now we have our placeholder.
                if (Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    star.AddSatellite(placeHolder);
                    currOrbit = placeHolder.OrbitalRadius;
                }

                if (star.GasGiantFlag != Star.GasgiantEpistellar && Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    //we're moving left.
                    //LEFT RIGHT LEFT
                    //.. sorry about that
                    var innerRadius = Star.InnerRadius(star.InitLumin, star.InitMass);
                    do
                    {
                        //as we're moving left, divide.
                        nextOrbit = currOrbit / LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit > currOrbit - distance)
                        {
                            nextOrbit = currOrbit - distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        //now let's check on
                    }
                    while (currOrbit > innerRadius);
                }

                //MOVE RIGHT!
                //now we have our placeholder.
                if (star.GasGiantFlag == Star.GasgiantEpistellar || Math.Abs(placeHolder.OrbitalRadius) < 0)
                {
                    var outerRadius = Star.OuterRadius(star.InitMass);
                    do
                    {
                        //as we're moving right, multiply.
                        nextOrbit = currOrbit * LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit < currOrbit + distance)
                        {
                            nextOrbit = currOrbit + distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        if (currOrbit < 0)
                        {
                            currOrbit = outerRadius + 10;
                        }
                        //now let's check on
                    }
                    while (currOrbit < outerRadius);
                }

                //if a clean zone has 0 planets, add one.
                foreach (var c in star.ZonesOfInterest.FormationZones.Where(c => !star.CleanZoneHasOrbits(c)))
                {
                    nextOrbit = star.PickInRange(c.GetRange());
                    ownership = star.GetOwnership(nextOrbit);
                    star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                }

                //sort orbitals
                star.SortOrbitals();
                star.GiveOrbitalsOrder(ref totalOrbCount);

                //now we get orbital contents, then fill in details
                LibStarGen.PopulateOrbits(star, VelvetBag);

                //set any star with all empty orbits to have one planet
                if (OptionCont.EnsureOneOrbit != null && ( !star.IsAllEmptyOrbits() || !(bool) OptionCont.EnsureOneOrbit ))
                {
                    continue;
                }
                var newPlanet = VelvetBag.Rng(1, star.SysPlanets.Count, -1);
                star.SysPlanets[newPlanet].UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeMedium);
            }

            foreach (var star in OurSystem.SysStars)
            {
                var distChart = LibStarGen.GenDistChart(OurSystem.SysStars);
                foreach (var sat in star.SysPlanets)
                {
                    sat.UpdateBlackBodyTemp(distChart, OurSystem.SysStars);
                }
                LibStarGen.CreatePlanets(OurSystem, star.SysPlanets, VelvetBag);
            }
            //-----------------------
            return OurSystem;
        }
Exemplo n.º 11
0
 public CleanZone( Range incoming, int ownership, int orbitDesc )
     : base(incoming)
 {
     OwnershipFlag = ownership;
     OrbitDesc = orbitDesc;
 }
Exemplo n.º 12
0
        /// <summary>
        ///     Sends the completed status and begins generating the planets
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">EventArgs object</param>
        private void btnGenPlanets_Click( object sender, EventArgs e )
        {
            //save options
            OptionCont.MoreConGasGiantChances = ChkConGasGiant.IsChecked != null && (bool) ChkConGasGiant.IsChecked;
            OptionCont.NoOceanOnlyGarden = OnlyGarden.IsChecked != null && (bool) OnlyGarden.IsChecked;
            OptionCont.MoreAccurateO2Catastrophe = ChkMoreAccurateO2Catastrophe.IsChecked != null && (bool) ChkMoreAccurateO2Catastrophe.IsChecked;
            OptionCont.StableActivity = FrcStableActivity.IsChecked != null && (bool) FrcStableActivity.IsChecked;
            OptionCont.NoMarginalAtm = NoMarginAtm.IsChecked != null && (bool) NoMarginAtm.IsChecked;
            OptionCont.HighRvmVal = HighRvm.IsChecked != null && (bool) HighRvm.IsChecked;
            OptionCont.OverrideHabitability = ChkHigherHabitability.IsChecked != null && (bool) ChkHigherHabitability.IsChecked;
            OptionCont.IgnoreLunarTidesOnGardenWorlds = IgnoreTides.IsChecked != null && (bool) IgnoreTides.IsChecked;
            OptionCont.RerollAxialTiltOver45 = ChkKeepAxialTiltUnder45.IsChecked != null && (bool) ChkKeepAxialTiltUnder45.IsChecked;
            OptionCont.AlwaysDisplayTidalData = ChkDisplayTidalData.IsChecked != null && (bool) ChkDisplayTidalData.IsChecked;
            OptionCont.ExpandAsteroidBelt = ChkExpandAsteroidBelt.IsChecked != null && (bool) ChkExpandAsteroidBelt.IsChecked;

            if (OverrideMoons.IsChecked == true)
            {
                OptionCont.SetNumberOfMoonsOverGarden(int.Parse(NumMoons.Text));
            }
            if (OverridePressure.IsChecked == true)
            {
                OptionCont.SetAtmPressure = double.Parse(NumAtmPressure.Text);
            }
            if (ChkOverrideTilt.IsChecked == true)
            {
                OptionCont.SetAxialTilt(int.Parse(NumTilt.Text));
            }

            //set the moon option.
            if (BookHigh.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonBookhigh;
            }
            if (BookMoon.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonBook;
            }
            if (ExtendHigh.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonExpandhigh;
            }
            if (ExtendNorm.IsChecked == true)
            {
                OptionCont.MoonOrbitFlag = OptionCont.MoonExpand;
            }

            //generate the planets!
            var totalOrbCount = 0; //total orbital count

            //first off, master loop.
            foreach (var star in OurSystem.SysStars)
            {
                if (!star.TestInitlizationZones())
                {
                    star.InitalizeZonesOfInterest();
                }
                for (var i = 1; i < OurSystem.SysStars.Count; i++)
                {
                    Range temp;
                    if (OurSystem.SysStars[i].ParentId == star.SelfId)
                    {
                        temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                        star.CreateForbiddenZone(temp, star.SelfId, OurSystem.SysStars[i].SelfId);
                    }
                    if (OurSystem.SysStars[i].SelfId != star.SelfId)
                    {
                        continue;
                    }
                    temp = new Range(OurSystem.SysStars[i].GetInnerForbiddenZone(), OurSystem.SysStars[i].GetOuterForbiddenZone());
                    star.CreateForbiddenZone(temp, star.ParentId, star.SelfId);
                }

                star.SortForbidden();
                star.CreateCleanZones();
                var placeHolder = new Satellite(0, 0, 0, 0);
                int ownership;
                if (star.GasGiantFlag != Star.GasgiantNone)
                {
                    double rangeAvail = 0, lowerBound = 0, diffRange = 0;
                    var spawnRange = new Range(0, 1);

                    //get range availability and spawn range

                    //CONVENTIONAL
                    if (star.GasGiantFlag == Star.GasgiantConventional)
                    {
                        rangeAvail = star.CheckConRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * 1;
                        diffRange = Star.SnowLine(star.InitLumin) * 1.5 - lowerBound;
                        spawnRange = star.GetConventionalRange();
                    }

                    //ECCENTRIC
                    if (star.GasGiantFlag == Star.GasgiantEccentric)
                    {
                        rangeAvail = star.CheckEccRange();
                        lowerBound = Star.SnowLine(star.InitLumin) * .125;
                        diffRange = Star.SnowLine(star.InitLumin) * .75 - lowerBound;
                        spawnRange = star.GetEccentricRange();
                    }

                    //EPISTELLAR
                    if (star.GasGiantFlag == Star.GasgiantEpistellar)
                    {
                        rangeAvail = star.CheckEpiRange();
                        lowerBound = Star.InnerRadius(star.InitLumin, star.InitMass) * .1;
                        diffRange = Star.InnerRadius(star.InitLumin, star.InitMass) * 1.8 - lowerBound;
                        spawnRange = star.GetEpistellarRange();
                    }

                    int roll;
                    double orbit;
                    if (rangeAvail >= .25)
                    {
                        do
                        {
                            orbit = VelvetBag.RollRange(lowerBound, diffRange);
                        }
                        while (!star.VerifyCleanOrbit(orbit));

                        ownership = star.GetOwnership(orbit);

                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }

                    if (rangeAvail >= .005 && rangeAvail < .25)
                    {
                        orbit = star.PickInRange(spawnRange);
                        ownership = star.GetOwnership(orbit);
                        if (star.GasGiantFlag == Star.GasgiantEpistellar)
                        {
                            ownership = star.SelfId;
                        }

                        placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BasetypeGasgiant);

                        roll = VelvetBag.GurpsRoll() + 4;
                        LibStarGen.UpdateGasGiantSize(placeHolder, roll);
                    }
                }

                //now we've determined our placeholdr, let's start working on our orbitals.

                double currOrbit = Star.InnerRadius(star.InitLumin, star.InitMass), nextOrbit;
                const double distance = .15;

                //now we have our placeholder.
                if (Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    star.AddSatellite(placeHolder);
                    currOrbit = placeHolder.OrbitalRadius;
                }

                if (star.GasGiantFlag != Star.GasgiantEpistellar && Math.Abs(placeHolder.OrbitalRadius) > 0)
                {
                    //we're moving left.
                    //LEFT RIGHT LEFT
                    //.. sorry about that
                    var innerRadius = Star.InnerRadius(star.InitLumin, star.InitMass);
                    do
                    {
                        //as we're moving left, divide.
                        nextOrbit = currOrbit / LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit > currOrbit - distance)
                        {
                            nextOrbit = currOrbit - distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        //now let's check on
                    }
                    while (currOrbit > innerRadius);
                }

                //MOVE RIGHT!
                //now we have our placeholder.
                if (star.GasGiantFlag == Star.GasgiantEpistellar || Math.Abs(placeHolder.OrbitalRadius) < 0)
                {
                    var outerRadius = Star.OuterRadius(star.InitMass);
                    do
                    {
                        //as we're moving right, multiply.
                        nextOrbit = currOrbit * LibStarGen.GetOrbitalRatio(VelvetBag);

                        if (nextOrbit < currOrbit + distance)
                        {
                            nextOrbit = currOrbit + distance;
                        }

                        if (star.VerifyCleanOrbit(nextOrbit) && star.WithinCreationRange(nextOrbit))
                        {
                            ownership = star.GetOwnership(nextOrbit);
                            star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                        }

                        currOrbit = nextOrbit;

                        if (currOrbit < 0)
                        {
                            currOrbit = outerRadius + 10;
                        }
                        //now let's check on
                    }
                    while (currOrbit < outerRadius);
                }

                //if a clean zone has 0 planets, add one.
                foreach (var c in star.ZonesOfInterest.FormationZones)
                {
                    if (!star.CleanZoneHasOrbits(c))
                    {
                        nextOrbit = star.PickInRange(c.GetRange());
                        ownership = star.GetOwnership(nextOrbit);
                        star.AddSatellite(new Satellite(ownership, 0, nextOrbit, 0));
                    }
                }

                //sort orbitals
                star.SortOrbitals();
                star.GiveOrbitalsOrder(ref totalOrbCount);

                //now we get orbital contents, then fill in details
                LibStarGen.PopulateOrbits(star, VelvetBag);

                //set any star with all empty orbits to have one planet
                if (!star.IsAllEmptyOrbits() || !(bool) OptionCont.EnsureOneOrbit)
                {
                    continue;
                }
                var newPlanet = VelvetBag.Rng(1, star.SysPlanets.Count, -1);
                star.SysPlanets[newPlanet].UpdateTypeSize(Satellite.BasetypeTerrestial, Satellite.SizeMedium);
            }

            foreach (var star in OurSystem.SysStars)
            {
                var distChart = LibStarGen.GenDistChart(OurSystem.SysStars);
                foreach (var sat in star.SysPlanets)
                {
                    sat.UpdateBlackBodyTemp(distChart, OurSystem.SysStars);
                }
                LibStarGen.CreatePlanets(OurSystem, star.SysPlanets, VelvetBag);
            }

            OParent.CreatePlanetsFinished = true;
            Close(); //close the form
        }
Exemplo n.º 13
0
 public ForbiddenZone( Range incoming, int primary, int secondary )
     : base(incoming)
 {
     PrimaryStar = primary;
     SecondaryStar = secondary;
 }