public override void OnStart(PartModule.StartState state) { KSPOperatingSystem.Boot(Path.Combine(Path.Combine(Environment.CurrentDirectory, "GameData"), "FlightComputer")); GameEvents.onPartDie.Add(OnExplosion); LastStartState = state; GUIController.lastStartState = state; GUIController.Start(); //Log.Write("TAC Examples-SimplePartModule [" + this.GetInstanceID().ToString("X") + "][" + Time.time.ToString("0.0000") + "]: OnStart: " + state); Log.Write("Starting with state: " + state); StartCoroutine("StartDelay"); startTime = 0; //drawer = new ProgramDrawer(this, loadedWindowRect, smallWindowRect); if (loadedPrograms == null) { KSPOperatingSystem.AddProgram(); } else { try { KSPOperatingSystem.LoadStateBase64(loadedPrograms, programsCompressed); Log.Write(KSPOperatingSystem.ProgramCount + " programs loaded from file"); } catch (Exception e) { KSPOperatingSystem.AddProgram(); Log.Write("Error loading program: " + e.Message + " (State: " + LastStartState + ")"); } loadedPrograms = null; } loadedPrograms = null; }
public override void OnLoad(ConfigNode node) { loadedPrograms = null; KSPOperatingSystem.Boot(Path.Combine(Path.Combine(Environment.CurrentDirectory, "GameData"), "FlightComputer")); //Log.Write("TAC Examples-SimplePartModule [" + this.GetInstanceID().ToString("X") + "][" + Time.time.ToString("0.0000") + "]: OnLoad: " + node); Log.Write("Loading program, State: " + LastStartState + ", Vessel: " + vessel); if (node.HasValue("FlightProgram")) { loadedPrograms = node.GetValue("FlightProgram"); programsCompressed = node.HasValue("IsCompressed"); } else { Log.Write("No program found!"); } GUIController.LoadState(node); }