private void Start() { textStyle = GuiUtils.PrepareBigText(Color.grey); sim.RefreshSimulationVariables(); altimeterSliderButtons = (AltimeterSliderButtons)FindObjectOfType(typeof(AltimeterSliderButtons)); GameEvents.onLaunch.Add(OnLaunch); GameEvents.onFlightReady.Add(OnFlightReady); if (_status != SimVesselStatus.Waiting) { if (FlightGlobals.fetch.activeVessel.situation != Vessel.Situations.PRELAUNCH) { _status = SimVesselStatus.Launched; Debug.Log($"[QuickIronMan]({name}) This vessel is already launched"); } else { _status = SimVesselStatus.Loaded; } } Debug.Log($"[QuickIronMan]({name}) Start, simulation: {sim.IsInSimulation()}"); }
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"); }
private void FixedUpdate() { if (_status != SimVesselStatus.Waiting || !flightReady) { return; } PauseMenu.Display(); _status = SimVesselStatus.Launched; }
private void OnLaunch(EventReport data) { _status = SimVesselStatus.Launched; if (!sim.IsInSimulation()) { FlightDriver.PreLaunchState = null; FlightDriver.PostInitState = null; Debug.Log($"[QuickIronMan]({name}) lost revert possibility"); } Debug.Log($"[QuickIronMan]({name}) Launch, Simulation: {sim.IsInSimulation()}"); }