Exemplo n.º 1
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;
     }
 }
Exemplo n.º 2
0
 public KspSystemDefinition GetConfigData()
 {
     KspSystemDefinition kspSystemDefinition;
     if (system_config == null)
     {
         return null;
     }
     else
     {
         if (!system_config.HasData && !system_config_valid)
         {
             return null;
         }
         else
         {
             ConfigNode kspNode = system_config.GetNode("KSPSystem");
             RootDefinition rootDefinition;
             double sun_solar_mass;
             SunType sun_solar_type;
             try
             {
                 sun_solar_mass = double.Parse(kspNode.GetNode("Root").GetValue("SolarMasses"));
             }
             catch
             {
                 sun_solar_mass = 7700;
             }
             try
             {
                 sun_solar_type = ((SunType)int.Parse(kspNode.GetNode("Root").GetValue("Type")));
             }
             catch
             {
                 sun_solar_type = SunType.Blackhole;
             }
             rootDefinition = new RootDefinition(sun_solar_mass, sun_solar_type);
             try
             {
                 kspSystemDefinition = new KspSystemDefinition(rootDefinition,
                     double.Parse(kspNode.GetNode("Kerbol").GetValue("semiMajorAxis")));
             }
             catch
             {
                 kspSystemDefinition = new KspSystemDefinition(rootDefinition, 4500000000000);
             }
             kspSystemDefinition.Stars = getStars(kspNode.GetNode("StarSystems").GetNodes("StarSystem"));
         }
     }
     return kspSystemDefinition;
 }