示例#1
0
 private void StopSimulationAndRevert()
 {
     sim.SetSimulation(false);
     if (_status != SimVesselStatus.Launched)
     {
         return;
     }
     if (FlightDriver.PreLaunchState == null)
     {
         var configNode = GamePersistence.LoadSFSFile("simulation", HighLogic.SaveFolder);
         if (configNode != null && HighLogic.CurrentGame != null)
         {
             var game = GamePersistence.LoadGameCfg(configNode, "simulation", true, false);
             FlightDriver.StartAndFocusVessel(game, game.flightState.activeVesselIdx);
             _status = SimVesselStatus.Waiting;
             Debug.Log($"[QuickIronMan]({name}) Revert to save");
             return;
         }
         _status = SimVesselStatus.Launched;
         Debug.Log($"[QuickIronMan]({name}) Something seems wrong, no simulation save, can't return before simulation start");
         return;
     }
     FlightDriver.RevertToLaunch();
     Debug.Log($"[QuickIronMan]({name}) Revert to launch");
 }
示例#2
0
 public static void OnLoadPipe(ConfigNode node)
 {
     LogDebug("Did the upgrade pipeline");
     HighLogic.CurrentGame = GamePersistence.LoadGameCfg(node, "default", true, false);
     if (HighLogic.CurrentGame == null)
     {
         LogDebug("Couldn't load game config node");
         return;
     }
     HighLogic.CurrentGame.startScene = _startScene;
     HighLogic.SaveFolder             = "default";
     HighLogic.CurrentGame.Start();
 }
示例#3
0
        static void OnLoadDialogPipelineFinished(ConfigNode node)
        {
            // Load game cfg
            HighLogic.CurrentGame = GamePersistence.LoadGameCfg(node, Game, true, false);
            if (HighLogic.CurrentGame == null)
            {
                Console.WriteLine("[kRPC testing tools]: Failed to load game, got null when loading game cfg");
                return;
            }
            if (GamePersistence.UpdateScenarioModules(HighLogic.CurrentGame))
            {
                Console.WriteLine("[kRPC testing tools]: Failed to load game, scenario update required");
                return;
            }

            // Find the vessel to switch to
            bool foundVessel = false;
            int  vesselIdx   = 0;

            foreach (var vessel in HighLogic.CurrentGame.flightState.protoVessels)
            {
                if (vessel.vesselType != VesselType.SpaceObject)
                {
                    foundVessel = true;
                    break;
                }
                vesselIdx++;
            }
            if (!foundVessel)
            {
                Console.WriteLine("[kRPC testing tools]: Failed to find vessel to switch to");
                return;
            }
            AutoSwitchVessel.Vessel = vesselIdx;

            // Load the game
            HighLogic.CurrentGame.startScene = GameScenes.SPACECENTER;
            HighLogic.SaveFolder             = Game;
            HighLogic.CurrentGame.Start();
        }
示例#4
0
 void OnLoadDialogPipelineFinished(ConfigNode node)
 {
     HighLogic.CurrentGame = GamePersistence.LoadGameCfg(node, game, true, false);
     if (HighLogic.CurrentGame != null)
     {
         if (GamePersistence.UpdateScenarioModules(HighLogic.CurrentGame))
         {
             if (node != null)
             {
                 GameEvents.onGameStatePostLoad.Fire(node);
             }
             GamePersistence.SaveGame(HighLogic.CurrentGame, save, game, SaveMode.OVERWRITE);
         }
         if (HighLogic.CurrentGame.startScene == GameScenes.FLIGHT)
         {
             AutoSwitchVessel.activeVessel = HighLogic.CurrentGame.flightState.activeVesselIdx;
             AutoSwitchVessel.save         = save;
         }
         HighLogic.CurrentGame.startScene = GameScenes.SPACECENTER;
         HighLogic.SaveFolder             = game;
         HighLogic.CurrentGame.Start();
     }
 }
示例#5
0
        static void onPipelineFinished(ConfigNode node, string saveName, Version originalVersion)
        {
            var game = GamePersistence.LoadGameCfg(node, saveName, true, false);

            if (game != null && game.flightState != null)
            {
                if (game.compatible)
                {
                    GamePersistence.UpdateScenarioModules(game);
                    if (node != null)
                    {
                        GameEvents.onGameStatePostLoad.Fire(node);
                    }
                    if (game.startScene != GameScenes.FLIGHT &&
                        originalVersion >= new Version(0, 24, 0))
                    {
                        GamePersistence.SaveGame(game, "persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE);
                        HighLogic.LoadScene(GameScenes.SPACECENTER);
                        return;
                    }
                }
                FlightDriver.StartAndFocusVessel(game, game.flightState.activeVesselIdx);
            }
        }