internal static void LaunchVessel() { if (selectedVessel == null) { Log.UserError("This was not ment to be called like this"); return; } ProtoVessel vesselToLaunch = selectedVessel; Log.Normal(selectedStoredVessel.vesselName); selectedHangar.storedVessels.Remove(selectedStoredVessel); selectedVessel = null; selectedHangar = null; selectedPart = null; // remove the control lock. which was created by the KSC Manager window InputLockManager.RemoveControlLock("KK_KSC"); if (KSCManager.isOpen) { WindowManager2.SavePosition(KSCManager.dialog); } GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE); selectedFacility = null; if (!useFromFlight) { useFromFlight = false; FlightDriver.StartAndFocusVessel("persistent", FlightGlobals.Vessels.IndexOf(vesselToLaunch.vesselRef)); } else { useFromFlight = false; vesselToLaunch.vesselRef.Load(); vesselToLaunch.vesselRef.MakeActive(); } }
/// <summary> /// Rollout the Vessel and store it in the placeHolder variable, then open the Crew assignment dialog /// </summary> /// <param name="storedVessel"></param> /// <param name="hangar"></param> internal static void SelectVessel(Modules.Hangar.StoredVessel storedVessel, Modules.Hangar hangar) { if (selectedVessel != null) { foreach (ProtoCrewMember crew in selectedVessel.GetVesselCrew()) { // unseat all crew crew.rosterStatus = ProtoCrewMember.RosterStatus.Available; crew.seatIdx = -1; } } selectedVessel = null; if (!hangar.storedVessels.Contains(storedVessel)) { Log.Error("no stored vessel found:" + storedVessel.vesselName); return; } selectedHangar = hangar; selectedStoredVessel = storedVessel; ProtoVessel protoVessel = new ProtoVessel(storedVessel.vesselNode, HighLogic.CurrentGame); protoVessel.Load(HighLogic.CurrentGame.flightState); selectedVessel = protoVessel; if (selectedVessel == null) { Log.UserError("Could not receive vessel from storage."); return; } Reload(); }