Ejemplo n.º 1
0
        public Star(StarSystemDefintion star, PSystemBody InternalStarPSB,PSystemBody InternalSunPSB)
        {
            defintion = star;
            var InternalStarCB = InternalStarPSB.celestialBody;

            //Set Star CB and PSB Parameters
            InternalStarPSB.name = star.Name;
            InternalStarPSB.flightGlobalsIndex = star.FlightGlobalsIndex;
            InternalStarPSB.children.Clear();

            InternalStarPSB.enabled = false;

            InternalStarCB.bodyName = star.Name;

            InternalStarCB.Radius = star.Radius;

            InternalStarCB.CBUpdate();

            //Add Star to Sun children
            InternalSunPSB.children.Add(InternalStarPSB);
        }
Ejemplo n.º 2
0
 private void Start()
 {
     Debug.Log("Ksp Solar System Start");
     if (ConfigSolarNodes.Instance.IsValid("system"))
     {
         kspSystemDefinition = ConfigSolarNodes.Instance.GetConfigData();
         if (kspSystemDefinition.Stars.Count == 0)
         {
             //kill the mod for bad config
             Debug.Log("Mod fall back , no stars found");
             kspSystemDefinition = null;
         }
         else
         {
             //Load Kerbol
             var Kerbol = new StarSystemDefintion();
             Kerbol.Name = "Kerbol";
             Kerbol.Inclination = 0;
             Kerbol.Eccentricity = 0;
             Kerbol.SemiMajorAxis = kspSystemDefinition.SemiMajorAxis;
             Kerbol.LAN = 0;
             Kerbol.ArgumentOfPeriapsis = 0;
             Kerbol.MeanAnomalyAtEpoch = 0;
             Kerbol.Epoch = 0;
             Kerbol.Mass = 1.7565670E28;
             Kerbol.Radius = 261600000d;
             Kerbol.FlightGlobalsIndex = 200;
             Kerbol.StarColor = PlanetColor.Yellow;
             Kerbol.ScienceMultiplier = 1f;
             Kerbol.OrignalStar = true;
             Kerbol.BodyDescription =
                 "The Sun is the most well known object in the daytime sky. Scientists have noted a particular burning sensation and potential loss of vision if it is stared at for long periods of time. This is especially important to keep in mind considering the effect shiny objects have on the average Kerbal.";
             kspSystemDefinition.Stars.Add(Kerbol);
             Debug.Log("Ksp Solar System Defintions loaded");
         }
     }
     else
     {
         //kill the mod for bad config
         Debug.Log("faild Config for the Mod ,stoped working");
         kspSystemDefinition = null;
     }
 }
Ejemplo n.º 3
0
        List<StarSystemDefintion> getStars(ConfigNode[] stars_config)
        {
            List<StarSystemDefintion> returnValue = new List<StarSystemDefintion>();
            //Grab star info
            foreach (var star in stars_config)
            {
                if (IsStarValid(star))
                {
                    var sun = star.GetNode("Sun");
                    StarSystemDefintion starSystemDefintion = new StarSystemDefintion();

                    starSystemDefintion.Name = sun.GetNode("CelestialBody").GetValue("name");
                    starSystemDefintion.FlightGlobalsIndex = int.Parse(sun.GetNode("CelestialBody").GetValue("flightGlobalIndex"));
                    starSystemDefintion.SemiMajorAxis = double.Parse(sun.GetNode("Orbit").GetValue("semiMajorAxis"));
                    try
                    {
                        starSystemDefintion.BodyDescription = sun.GetNode("CelestialBody").GetValue("BodyDescription");
                    }
                    catch (Exception e)
                    {
                    }

                    try
                    {
                        starSystemDefintion.Radius = double.Parse(sun.GetNode("CelestialBody").GetValue("Radius"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.Radius = 261600000;
                    }
                    try
                    {
                        starSystemDefintion.StarColor =
                            (PlanetColor)
                                EnumUtilities.Parse(typeof (PlanetColor),
                                    sun.GetNode("CelestialBody").GetValue("StarColor"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.StarColor = PlanetColor.Yellow;
                    }
                    try
                    {
                        starSystemDefintion.Mass = double.Parse(sun.GetNode("CelestialBody").GetValue("Mass"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.Mass = 1.7565670E28;
                    }
                    try
                    {
                        starSystemDefintion.ScienceMultiplier =
                            float.Parse(sun.GetNode("CelestialBody").GetValue("ScienceMultiplier"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.ScienceMultiplier = 10f;
                    }
                    try
                    {
                        starSystemDefintion.Inclination = double.Parse(sun.GetNode("Orbit").GetValue("inclination"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.Inclination = 0;
                    }
                    try
                    {
                        starSystemDefintion.Eccentricity = double.Parse(sun.GetNode("Orbit").GetValue("eccentricity"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.Eccentricity = 0;
                    }
                    try
                    {
                        starSystemDefintion.LAN = double.Parse(sun.GetNode("Orbit").GetValue("LAN"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.LAN = 0;
                    }
                    try
                    {
                        starSystemDefintion.ArgumentOfPeriapsis =
                            double.Parse(sun.GetNode("Orbit").GetValue("argumentOfPeriapsis"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.ArgumentOfPeriapsis = 0;
                    }
                    try
                    {
                        starSystemDefintion.MeanAnomalyAtEpoch = double.Parse(sun.GetNode("Orbit").GetValue("meanAnomalyAtEpoch"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.MeanAnomalyAtEpoch = 0;
                    }
                    try
                    {
                        starSystemDefintion.Epoch = double.Parse(sun.GetNode("Orbit").GetValue("epoch"));
                    }
                    catch (Exception e)
                    {
                        starSystemDefintion.Epoch = 0;
                    }
                    returnValue.Add(starSystemDefintion);
                }
                else
                {
                    Debug.Log("Star Unable be create lack requirement fields: CelestialBody/name,CelestialBody/flightGlobalIndex,Orbit/semiMajorAxis");
                    continue;
                }
            }
            return returnValue;
        }