public override void OnLoad (ConfigNode vesselNode) { Utilities.LogVerbose("#X1 RoverScience OnLoad @" + DateTime.Now); Instance = this; if (rover == null) { Utilities.LogVerbose("rover was null, creating new rover class (OnLoad)"); rover = new Rover(); } if (DB != null) DB.UpdateRoverScience(); }
public override void OnStart(PartModule.StartState state) { if (HighLogic.LoadedSceneIsFlight) { if (IsPrimary) { Debug.Log("RoverScience 2 initiated!"); Debug.Log("RoverScience version: " + RSVersion); Instance = this; Debug.Log("RS Instance set - " + Instance); container = part.Modules ["ModuleScienceContainer"] as ModuleScienceContainer; command = part.Modules ["ModuleCommand"] as ModuleCommand; // Must be called here otherwise they won't run their constructors for some reason if (rover == null) { Debug.Log("rover was null, creating new rover class (OnStart)"); rover = new Rover(); } rover.scienceSpot = new ScienceSpot(Instance); rover.landingSpot = new LandingSpot(Instance); //try //{ if (DB != null) { DB.updateRoverScience(); } //} //catch { } rover.setClosestAnomaly(vessel.mainBody.bodyName); } else { Debug.Log("ONSTART - Not primary"); } if (Instance == null) { Instance = this; Debug.Log("Instance was null; workaround fix by declaring Instance anyway"); } } }
public override void OnStart(PartModule.StartState state) { if (HighLogic.LoadedSceneIsFlight) { if (IsPrimary) { Utilities.Log("Initiated! Version: " + RSVersion); Instance = this; Utilities.LogVerbose("RS Instance set - " + Instance); HomeWorld = FlightGlobals.Bodies.Where(cb => cb.isHomeWorld).First(); // TODO: move this somewhere more appropriate container = part.Modules ["ModuleScienceContainer"] as ModuleScienceContainer; command = part.Modules ["ModuleCommand"] as ModuleCommand; // HACK: Must be called here otherwise they won't run their constructors for some reason if (rover == null) { Utilities.LogVerbose("rover was null, creating new rover class (OnStart)"); rover = new Rover(); } rover.scienceSpot = new ScienceSpot(Instance); rover.landingSpot = new LandingSpot(Instance); if (DB != null) { DB.UpdateRoverScience(); } rover.SetClosestAnomaly(); } else { Utilities.Log("ONSTART - Not primary"); } // HACK: instance null unexpected. if (Instance == null) { Instance = this; Utilities.Log("Instance was null; workaround fix by declaring Instance anyway"); } } }
public override void OnLoad(ConfigNode vesselNode) { Debug.Log("#X1 RoverScience OnLoad @" + DateTime.Now); Instance = this; if (rover == null) { Debug.Log("rover was null, creating new rover class (OnLoad)"); rover = new Rover(); } // try //{ if (DB != null) { DB.updateRoverScience(); } //}catch{ //} }
public ScienceSpot(RoverScience roverScience) { this.roverScience = roverScience; }
public LandingSpot(RoverScience roverScience) { this.roverScience = roverScience; }