/// <summary> /// Update the display based on a mass update /// </summary> /// <param name="sender">The object sending you here</param> /// <param name="e">Event arguments</param> private void numCurrMass_Leave(object sender, EventArgs e) { //first, initial luminosity txtInitLumin.Text = Star.getMinLumin((double)numCurrMass.Value).ToString(); //now we need to get an updated timeline this.currAgeChart.addMainLimit(Star.findMainLimit((double)numCurrMass.Value)); this.currAgeChart.addSubLimit(Star.findSubLimit((double)numCurrMass.Value)); this.currAgeChart.addGiantLimit(Star.findGiantLimit((double)numCurrMass.Value)); //now we need to get what stage we are and push the details to the field. lblEndMain.Text = "End of Main Sequence: " + this.currAgeChart.getMainLimit() + " GYr"; lblEndSubGiant.Text = "End of the Sub Giant Sequence: " + this.currAgeChart.getSubLimit() + " GYr"; lblEndGiantPhase.Text = "End of the Giant Phase: " + this.currAgeChart.getGiantLimit() + " GYr"; this.currAgeStatus = this.currAgeChart.findCurrentAgeGroup((double)numAge.Value); lblCurrentStage.Text = "Current Status: " + StarAgeLine.descBranch(this.currAgeStatus); //now we can get the current luminosity, figure out what the intial mass is. //and fill in the effective temperature if it's no longer in range. numInitMass.Value = numCurrMass.Value; txtCurrLumin.Text = Math.Round(Star.getCurrLumin(this.currAgeChart, (double)numAge.Value, (double)numCurrMass.Value), 3).ToString(); double temp; temp = Star.getCurrentTemp(this.currAgeChart, Convert.ToDouble(txtCurrLumin.Text), (double)numAge.Value, (double)numCurrMass.Value, this.myDice); txtEffTemp.Text = Convert.ToString(temp); //set good ranges createAcceptRanges(Star.getCurrLumin(this.currAgeChart, (double)numAge.Value, (double)numCurrMass.Value), temp); //display information for users benefits (formation zones, colors) this.color = Star.setColor(this.myDice, temp); lblStellarColor.Text = "Stellar Color: " + color; lblStellarRadius.Text = "Stellar Radius: " + Star.getRadius((double)numCurrMass.Value, temp, Star.getCurrLumin(this.currAgeChart, (double)numAge.Value, (double)numCurrMass.Value), this.currAgeChart.findCurrentAgeGroup((double)numAge.Value)) + " AU"; lblInnerFormation.Text = "Inner Formation Range: " + Star.innerRadius(Convert.ToDouble(txtInitLumin.Text), (double)numInitMass.Value) + " AU"; lblOuterFormation.Text = "Outer Formation Range: " + Star.outerRadius((double)numInitMass.Value) + " AU"; lblSnowLine.Text = "Snow Line: " + Star.snowLine(Convert.ToDouble(txtInitLumin.Text)) + " AU"; if ((double)numCurrMass.Value > .525) { chkFlareStar.Checked = false; chkFlareStar.Enabled = false; } }
/// <summary> /// Display the star's details /// </summary> private void displayFromStar() { txtName.Text = this.ourSystem.sysStars[this.starID].name; numInitMass.Value = (decimal)this.ourSystem.sysStars[this.starID].initMass; numCurrMass.Value = (decimal)this.ourSystem.sysStars[this.starID].currMass; txtInitLumin.Text = this.ourSystem.sysStars[this.starID].initLumin.ToString(); txtCurrLumin.Text = this.ourSystem.sysStars[this.starID].currLumin.ToString(); txtEffTemp.Text = this.ourSystem.sysStars[this.starID].effTemp.ToString(); createAcceptRanges(this.ourSystem.sysStars[this.starID].currLumin, this.ourSystem.sysStars[this.starID].effTemp); numAge.Value = (decimal)this.ourSystem.sysStars[this.starID].starAge; if ((double)numCurrMass.Value > .525) { chkFlareStar.Enabled = false; } if (this.ourSystem.sysStars[this.starID].isFlareStar) { chkFlareStar.Checked = true; } txtOrbitalParent.Text = this.ourSystem.sysStars[this.starID].parentName; txtRadius.Text = this.ourSystem.sysStars[this.starID].orbitalRadius.ToString(); numEccent.Value = (decimal)this.ourSystem.sysStars[this.starID].orbitalEccent; lblStellarColor.Text = "Stellar Color: " + this.ourSystem.sysStars[this.starID].starColor; this.currAgeStatus = this.ourSystem.sysStars[this.starID].evoLine.findCurrentAgeGroup((double)numAge.Value); lblCurrentStage.Text = "Current Status: " + StarAgeLine.descBranch(this.currAgeStatus); //MessageBox.Show(Star.getRadius(this.ourSystem.sysStars[this.starID].currMass, this.ourSystem.sysStars[this.starID].effTemp, this.ourSystem.sysStars[this.starID].currLumin, this.currAgeStatus).ToString()); lblStellarRadius.Text = "Star Radius: " + this.ourSystem.sysStars[this.starID].radius + " AU"; lblInnerFormation.Text = "Inner Radius of Formation Zone: " + Star.innerRadius(this.ourSystem.sysStars[this.starID].initLumin, this.ourSystem.sysStars[this.starID].initMass) + " AU"; lblOuterFormation.Text = "Outer Radius of Formation Zone: " + Star.outerRadius(this.ourSystem.sysStars[this.starID].initMass) + " AU"; lblSnowLine.Text = "Snow Line: " + Star.snowLine(this.ourSystem.sysStars[this.starID].initLumin) + " AU"; lblPeriapsis.Text = "Periapsis: " + Star.getPeriapsis((double)numEccent.Value, Convert.ToDouble(txtRadius.Text)) + " AU"; lblApapsis.Text = "Apapsis: " + Star.getApapsis((double)numEccent.Value, Convert.ToDouble(txtRadius.Text)) + " AU"; lblEndMain.Text = "End of Main Sequence: " + this.ourSystem.sysStars[this.starID].evoLine.getMainLimit() + " GYr"; lblEndSubGiant.Text = "End of the Sub Giant Sequence: " + this.ourSystem.sysStars[this.starID].evoLine.getSubLimit() + " GYr"; lblEndGiantPhase.Text = "End of the Giant Phase: " + this.ourSystem.sysStars[this.starID].evoLine.getGiantLimit() + " GYr"; this.currAgeStatus = this.ourSystem.sysStars[this.starID].evoLine.findCurrentAgeGroup((double)numAge.Value); lblCurrentStage.Text = "Current Status: " + StarAgeLine.descBranch(this.currAgeStatus); }
public override string ToString() { String ret; String nL = Environment.NewLine + " "; ret = this.name + " is a " + this.getStatusDesc() + " star with spectral type " + this.specType; ret = ret + nL + "This star has " + this.currMass + " solar masses, and a current luminosity of " + Math.Round(this.currLumin, OptionCont.numberOfDecimal); ret = ret + nL + "solar luminosities. It has a surface temperature of " + Math.Round(this.effTemp, OptionCont.numberOfDecimal) + "K."; ret = ret + nL + "This star's radius is " + Math.Round(this.getRadiusAU(), OptionCont.numberOfDecimal) + " AU."; ret = ret + nL + "Apparent Color : " + this.starColor; if (OptionCont.getVerboseOutput()) { ret = ret + Environment.NewLine; ret = ret + nL + "Initial Luminosity: " + this.initLumin + " solar luminosities."; ret = ret + nL + "Initial Mass: " + this.initMass + " solar masses"; ret = ret + nL + "Formation Zones: " + Star.innerRadius(this.initLumin, this.initMass) + " AU to " + Math.Round(Star.outerRadius(this.initMass), OptionCont.numberOfDecimal) + " AU"; ret = ret + nL + "Snow Line: " + Math.Round(Star.snowLine(this.initLumin), OptionCont.numberOfDecimal) + " AU."; } ret = ret + Environment.NewLine; if (this.isFlareStar) { ret = ret + nL + "This star is a flare star."; } ret = ret + Environment.NewLine; if (OptionCont.getVerboseOutput()) { ret = ret + nL + "Self ID: " + Star.getDescSelfFlag(this.selfID) + " and Parent ID: " + Star.getDescSelfFlag(this.parentID); ret = ret + nL; } //printing out age details ret = ret + nL + "Evolution Data"; ret = ret + Environment.NewLine; if (this.evoLine.getGiantLimit() < 1000) { ret = ret + nL + "Main Sequence Ends: " + this.evoLine.getMainLimit() + " Gyr,"; ret = ret + " Subgiant Ends: " + this.evoLine.getSubLimit() + " Gyr"; ret = ret + nL + "Giant Stage Ends: " + this.evoLine.getGiantLimit() + " Gyr"; if (this.starAge < this.evoLine.getMainLimit()) { ret = ret + nL + "This star will exit the main sequence phase in: " + (this.evoLine.getMainLimit() - this.starAge) + " Gyr"; } if (this.starAge >= this.evoLine.getMainLimit() && this.starAge < this.evoLine.getSubLimit()) { ret = ret + nL + "This star will exit the subgiant phase in: " + (this.evoLine.getSubLimit() - this.starAge) + " Gyr"; } if (this.starAge >= this.evoLine.getSubLimit() && this.starAge < this.evoLine.getGiantLimit()) { ret = ret + nL + "This star will exit the giant phase in: " + (this.evoLine.getGiantLimit() - this.starAge) + " Gyr"; } if (this.starAge >= this.evoLine.getGiantLimit()) { ret = ret + nL + "This star has been a white dwarf for: " + (this.starAge - this.evoLine.getGiantLimit()) + " Gyr"; } } else { ret = ret + nL + "This star will burn out sometime well after the galaxy disappears."; } if (this.selfID != Star.IS_PRIMARY) { ret = ret + Environment.NewLine; ret = ret + nL + "Orbital Details"; ret = ret + nL + "This orbits " + this.parentName + " at " + this.orbitalRadius + " AU."; if (this.orbitalEccent > 0) { ret = ret + nL + "Eccentricity: " + this.orbitalEccent + "."; ret = ret + nL + "Periapsis: " + Orbital.getPeriapsis(this.orbitalEccent, this.orbitalRadius) + " AU and Apapasis: " + Orbital.getApapsis(this.orbitalEccent, this.orbitalRadius) + " AU."; } ret = ret + nL + "Orbital period is " + Math.Round(this.orbitalPeriod, 2) + " years (" + Math.Round(this.orbitalPeriod * 365.25, 2); ret = ret + " days)"; ret = ret + nL + "This has a seperation of " + libStarGen.getSeperationStr(this.orbitalSep); } ret = ret + nL; ret = ret + nL + "Orbital Details"; foreach (Satellite s in this.sysPlanets) { ret = ret + nL + s; ret = ret + nL; } ret = ret + nL; if (OptionCont.getVerboseOutput()) { ret = ret + nL; ret = ret + nL + "Formation Zone Details"; ret = ret + nL; foreach (forbiddenZone r in this.zonesOfInterest.forbiddenZones) { ret = ret + nL + r; } ret = ret + nL; foreach (cleanZone r in this.zonesOfInterest.formationZones) { ret = ret + nL + r; } ret = ret + nL; ret = ret + nL + "Gas Giant Flag: " + Star.descGasGiantFlag(this.gasGiantFlag); ret = ret + nL; } return(ret); }
public bool containsGasGiants(bool pastSnowLine = true) { foreach (Satellite s in this.sysPlanets) { if (!pastSnowLine) { if (s.SatelliteType == Satellite.BASETYPE_GASGIANT) { return(true); } else if (s.SatelliteType == Satellite.BASETYPE_GASGIANT && s.orbitalRadius > Star.snowLine(this.initLumin)) { return(true); } } } return(false); }
/// <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.Checked; OptionCont.noOceanOnlyGarden = onlyGarden.Checked; OptionCont.moreAccurateO2Catastrophe = chkMoreAccurateO2Catastrophe.Checked; OptionCont.stableActivity = frcStableActivity.Checked; OptionCont.noMarginalAtm = noMarginAtm.Checked; OptionCont.highRVMVal = highRVM.Checked; OptionCont.overrideHabitability = chkHigherHabitability.Checked; OptionCont.ignoreLunarTidesOnGardenWorlds = ignoreTides.Checked; OptionCont.rerollAxialTiltOver45 = chkKeepAxialTiltUnder45.Checked; OptionCont.alwaysDisplayTidalData = chkDisplayTidalData.Checked; OptionCont.expandAsteroidBelt = chkExpandAsteroidBelt.Checked; if (overrideMoons.Checked) { OptionCont.setNumberOfMoonsOverGarden((int)numMoons.Value); } if (overridePressure.Checked) { OptionCont.setAtmPressure = (double)numAtmPressure.Value; } if (chkOverrideTilt.Checked) { OptionCont.setAxialTilt((int)numTilt.Value); } //set the moon option. if (bookHigh.Checked) { OptionCont.moonOrbitFlag = OptionCont.MOON_BOOKHIGH; } if (bookMoon.Checked) { OptionCont.moonOrbitFlag = OptionCont.MOON_BOOK; } if (extendHigh.Checked) { OptionCont.moonOrbitFlag = OptionCont.MOON_EXPANDHIGH; } if (extendNorm.Checked) { OptionCont.moonOrbitFlag = OptionCont.MOON_EXPAND; } //generate the planets! int totalOrbCount = 0; //total orbital count //first off, master loop. for (int currStar = 0; currStar < this.ourSystem.sysStars.Count; currStar++) { Range temp; //draw up forbidden zones. if (!this.ourSystem.sysStars[currStar].testInitlizationZones()) { this.ourSystem.sysStars[currStar].initalizeZonesOfInterest(); } for (int i = 1; i < this.ourSystem.sysStars.Count; i++) { if (this.ourSystem.sysStars[i].parentID == this.ourSystem.sysStars[currStar].selfID) { temp = new Range(this.ourSystem.sysStars[i].getInnerForbiddenZone(), this.ourSystem.sysStars[i].getOuterForbiddenZone()); this.ourSystem.sysStars[currStar].createForbiddenZone(temp, this.ourSystem.sysStars[currStar].selfID, this.ourSystem.sysStars[i].selfID); } if (this.ourSystem.sysStars[i].selfID == this.ourSystem.sysStars[currStar].selfID) { temp = new Range(this.ourSystem.sysStars[i].getInnerForbiddenZone(), this.ourSystem.sysStars[i].getOuterForbiddenZone()); this.ourSystem.sysStars[currStar].createForbiddenZone(temp, this.ourSystem.sysStars[currStar].parentID, this.ourSystem.sysStars[currStar].selfID); } } this.ourSystem.sysStars[currStar].sortForbidden(); this.ourSystem.sysStars[currStar].createCleanZones(); //gas giant flag // libStarGen.gasGiantFlag(this.ourSystem.sysStars[currStar], velvetBag.gurpsRoll()); Satellite placeHolder = new Satellite(0, 0, 0, 0); int ownership, roll; double orbit = 0; if (this.ourSystem.sysStars[currStar].gasGiantFlag != Star.GASGIANT_NONE) { double rangeAvail = 0, lowerBound = 0, diffRange = 0; Range spawnRange = new Range(0, 1); //get range availability and spawn range //CONVENTIONAL if (this.ourSystem.sysStars[currStar].gasGiantFlag == Star.GASGIANT_CONVENTIONAL) { rangeAvail = this.ourSystem.sysStars[currStar].checkConRange(); lowerBound = Star.snowLine(this.ourSystem.sysStars[currStar].initLumin) * 1; diffRange = (Star.snowLine(this.ourSystem.sysStars[currStar].initLumin) * 1.5) - lowerBound; spawnRange = this.ourSystem.sysStars[currStar].getConventionalRange(); } //ECCENTRIC if (this.ourSystem.sysStars[currStar].gasGiantFlag == Star.GASGIANT_ECCENTRIC) { rangeAvail = this.ourSystem.sysStars[currStar].checkEccRange(); lowerBound = Star.snowLine(this.ourSystem.sysStars[currStar].initLumin) * .125; diffRange = (Star.snowLine(this.ourSystem.sysStars[currStar].initLumin) * .75) - lowerBound; spawnRange = this.ourSystem.sysStars[currStar].getEccentricRange(); } //EPISTELLAR if (this.ourSystem.sysStars[currStar].gasGiantFlag == Star.GASGIANT_EPISTELLAR) { rangeAvail = this.ourSystem.sysStars[currStar].checkEpiRange(); lowerBound = Star.innerRadius(this.ourSystem.sysStars[currStar].initLumin, this.ourSystem.sysStars[currStar].initMass) * .1; diffRange = (Star.innerRadius(this.ourSystem.sysStars[currStar].initLumin, this.ourSystem.sysStars[currStar].initMass) * 1.8) - lowerBound; spawnRange = this.ourSystem.sysStars[currStar].getEpistellarRange(); } if (rangeAvail >= .25) { do { orbit = velvetBag.rollRange(lowerBound, diffRange); } while (!this.ourSystem.sysStars[currStar].verifyCleanOrbit(orbit)); ownership = this.ourSystem.sysStars[currStar].getOwnership(orbit); if (this.ourSystem.sysStars[currStar].gasGiantFlag == Star.GASGIANT_EPISTELLAR) { ownership = this.ourSystem.sysStars[currStar].selfID; } placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BASETYPE_GASGIANT); roll = velvetBag.gurpsRoll() + 4; libStarGen.updateGasGiantSize(placeHolder, roll); } if (rangeAvail >= .005 && rangeAvail < .25) { orbit = this.ourSystem.sysStars[currStar].pickInRange(spawnRange); ownership = this.ourSystem.sysStars[currStar].getOwnership(orbit); if (this.ourSystem.sysStars[currStar].gasGiantFlag == Star.GASGIANT_EPISTELLAR) { ownership = this.ourSystem.sysStars[currStar].selfID; } placeHolder = new Satellite(ownership, 0, orbit, 0, Satellite.BASETYPE_GASGIANT); 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(this.ourSystem.sysStars[currStar].initLumin, this.ourSystem.sysStars[currStar].initMass), nextOrbit = 0; double distance = .15; //now we have our placeholder. if (placeHolder.orbitalRadius != 0) { this.ourSystem.sysStars[currStar].addSatellite(placeHolder); currOrbit = placeHolder.orbitalRadius; } if (this.ourSystem.sysStars[currStar].gasGiantFlag != Star.GASGIANT_EPISTELLAR && placeHolder.orbitalRadius != 0) { //we're moving left. //LEFT RIGHT LEFT //.. sorry about that double innerRadius = Star.innerRadius(this.ourSystem.sysStars[currStar].initLumin, this.ourSystem.sysStars[currStar].initMass); do { //as we're moving left, divide. nextOrbit = currOrbit / libStarGen.getOrbitalRatio(velvetBag); if (nextOrbit > currOrbit - distance) { nextOrbit = currOrbit - distance; } if (this.ourSystem.sysStars[currStar].verifyCleanOrbit(nextOrbit) && this.ourSystem.sysStars[currStar].withinCreationRange(nextOrbit)) { ownership = this.ourSystem.sysStars[currStar].getOwnership(nextOrbit); this.ourSystem.sysStars[currStar].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 (this.ourSystem.sysStars[currStar].gasGiantFlag == Star.GASGIANT_EPISTELLAR || placeHolder.orbitalRadius == 0) { double outerRadius = Star.outerRadius(this.ourSystem.sysStars[currStar].initMass); do { //as we're moving right, multiply. nextOrbit = currOrbit * libStarGen.getOrbitalRatio(velvetBag); if (nextOrbit < currOrbit + distance) { nextOrbit = currOrbit + distance; } if (this.ourSystem.sysStars[currStar].verifyCleanOrbit(nextOrbit) && this.ourSystem.sysStars[currStar].withinCreationRange(nextOrbit)) { ownership = this.ourSystem.sysStars[currStar].getOwnership(nextOrbit); this.ourSystem.sysStars[currStar].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 (cleanZone c in this.ourSystem.sysStars[currStar].zonesOfInterest.formationZones) { if (!this.ourSystem.sysStars[currStar].cleanZoneHasOrbits(c)) { nextOrbit = this.ourSystem.sysStars[currStar].pickInRange(c.getRange()); ownership = this.ourSystem.sysStars[currStar].getOwnership(nextOrbit); this.ourSystem.sysStars[currStar].addSatellite(new Satellite(ownership, 0, nextOrbit, 0)); } } //sort orbitals this.ourSystem.sysStars[currStar].sortOrbitals(); this.ourSystem.sysStars[currStar].giveOrbitalsOrder(ref totalOrbCount); //now we get orbital contents, then fill in details libStarGen.populateOrbits(this.ourSystem.sysStars[currStar], velvetBag); //set any star with all empty orbits to have one planet if (this.ourSystem.sysStars[currStar].isAllEmptyOrbits() && OptionCont.ensureOneOrbit) { int newPlanet = velvetBag.rng(1, this.ourSystem.sysStars[currStar].sysPlanets.Count, -1); this.ourSystem.sysStars[currStar].sysPlanets[newPlanet].updateTypeSize(Satellite.BASETYPE_TERRESTIAL, Satellite.SIZE_MEDIUM); } } for (int currStar = 0; currStar < this.ourSystem.sysStars.Count; currStar++) { double[,] distChart = libStarGen.genDistChart(this.ourSystem.sysStars); for (int i = 0; i < this.ourSystem.sysStars[currStar].sysPlanets.Count; i++) { this.ourSystem.sysStars[currStar].sysPlanets[i].updateBlackBodyTemp(distChart, this.ourSystem.sysStars); } libStarGen.createPlanets(this.ourSystem, this.ourSystem.sysStars[currStar].sysPlanets, velvetBag); } parent.createPlanetsFinished = true; this.Close(); //close the form }
public virtual Range getConventionalRange() { return(new Range(Star.snowLine(this.initLumin), 1.5 * Star.snowLine(this.initLumin))); }
public virtual Range getEccentricRange() { return(new Range(.125 * Star.snowLine(this.initLumin), .75 * Star.snowLine(this.initLumin))); }