public bool SetAsteroidID(Vessel v) { Debug.Log("Testing new contract "); AsteroidVesselID = v.id.ToString(); if (AsteroidVesselID == "") { return(false); } Debug.Log("Generating new contract for AsteroidVesselID " + AsteroidVesselID); //AsteroidPartID = v.parts.Find(s => s.name == "PotatoRoid").flightID.ToString (); //AsteroidPartID = v.id.ToString(); Description2 = "An incomming astroid has been detected! We need you to divert:"; AsteroidName = v.vesselName; CelestialBody targetBody = FlightGlobals.Bodies [1]; //Kerbin. base.SetDeadlineYears(1f, targetBody); Debug.Log("Set Asteroid as detected "); GetParameter <AsteroidDectectedParameters> (MissionSeed.ToString() + "Dectected").SetAsteroidName(AsteroidName); GetParameter <AsteroidRedirectAltitudeParameters> (MissionSeed.ToString() + "Altitude").SetAsteroidName(AsteroidName); GetParameter <AsteroidRedirectDockingParameters> (MissionSeed.ToString() + "Docking").SetAsteroidValues(AsteroidName, AsteroidVesselID); EmptyContract = false; return(true); }
protected override bool Generate() { Description1 = "We have reason to believe an asteroid is Heading for Kerbin. We want you to divert the next detected asteroid by putting it in a stable orbit around Kerbin."; Description2 = "This contract will update as soon as new asteroid is detected."; CelestialBody targetBody = FlightGlobals.Bodies [1]; //Kerbin. base.SetExpiry(); base.SetScience(2.25f, targetBody); base.SetDeadlineYears(1f, targetBody); base.SetReputation(150f, 60f, targetBody); base.SetFunds(100f, 50000f, 75000f, targetBody); AddParameter(new AsteroidDectectedParameters(), MissionSeed.ToString() + "Dectected"); AddParameter(new AsteroidRedirectAltitudeParameters(), MissionSeed.ToString() + "Altitude"); AddParameter(new AsteroidRedirectDockingParameters(), MissionSeed.ToString() + "Docking"); this.AddParameter(new StabilityParameter(10)); return(true); }
protected override string GetHashString() { return((contractType != null ? contractType.name : "null") + MissionSeed.ToString() + DateAccepted.ToString()); }