Beispiel #1
0
        /// <summary>
        /// When entering trackingstation
        /// </summary>
        void Update()
        {
            if (HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                if (StarSystem.Initialized == false)
                {
                    MoveStandardPlanets.MoveToKerbol();

                    var PatchedSaveGames = ConfigNode.Load("GameData/StarSystems/Config/PatchedSaveGames.cfg");

                    if (PatchedSaveGames.GetNode("PatchedSaveGames").GetValue(HighLogic.CurrentGame.Title) == null)
                    {
                        PatchedSaveGames.GetNode("PatchedSaveGames").AddValue(HighLogic.CurrentGame.Title, "Patched");
                        PatchedSaveGames.Save("GameData/StarSystems/Config/PatchedSaveGames.cfg");
                        StarSystem.NeedsPatching = true;
                    }
                }
            }

            if (StarSystem.NeedsPatching == true && FlightGlobals.Vessels.Count != 0)
            {
                foreach (var Vessel in FlightGlobals.Vessels)
                {
                    if (Vessel.orbitDriver.orbit.referenceBody == StarSystem.CBDict["Sun"])
                    {
                        Debug.Log("Patching " + Vessel.name);
                        Vessel.orbitDriver.referenceBody = StarSystem.CBDict["Kerbol"];
                        Vessel.orbitDriver.UpdateOrbit();
                        Debug.Log(Vessel.name + "Patched");
                    }
                }

                StarSystem.NeedsPatching = false;
            }
        }
Beispiel #2
0
        public void OnLevelWasLoaded(int level)
        {
            if (kspSystemDefinition != null)
            {
                Debug.Log("Level: " + level);

                switch (level)
                {
                case 10:    //prerender before main menu
                    PlanetariumCamera.fetch.maxDistance = 5000000000;
                    Debug.Log("Creating basis for new stars...");

                    PSystemBodies.GrabPSystemBodies(PSystemManager.Instance.systemPrefab.rootBody);

                    //Create base for new stars
                    foreach (StarSystemDefintion star in kspSystemDefinition.Stars)
                    {
                        //Grab Sun Internal PSystemBody
                        var InternalSunPSB = PSystemManager.Instance.systemPrefab.rootBody;
                        var InternalSunCB  = InternalSunPSB.celestialBody;

                        //Instantiate Sun Internal PSystemBody
                        var InternalStarPSB = (PSystemBody)Instantiate(InternalSunPSB);
                        DontDestroyOnLoad(InternalStarPSB);
                        StarDict.Add(star.Name, new Star(star, InternalStarPSB, InternalSunPSB));
                        PSBDict[InternalStarPSB.celestialBody.bodyName] = InternalStarPSB;
                    }


                    Debug.Log("Basis for new stars created");

                    //Planet.CreatePlanet("Duna", "DunaClone", "Dolas", 300, 50000000);

                    //PsystemReady trigger
                    PSystemManager.Instance.OnPSystemReady.Add(OnPSystemReady);
                    break;

                case 8:    //tracking station
                    break;

                case 5:    //space center
                    //Set sun to Kerbol when loading space center
                    break;

                case 2:    //main menu
                    if (Initialized == true)
                    {
                        MoveStandardPlanets.MoveToSun();
                    }
                    break;
                }
            }
        }