private bool EjectFromOtherPart() { Part fromPart = part; foreach (var toPart in part.vessel.parts) { if (toPart == part) { continue; } if (toPart.CrewCapacity > 0 && !FlightEVA.hatchInsideFairing(toPart) && !FlightEVA.HatchIsObstructed(toPart, toPart.airlock)) { var crewTransfer = CrewTransfer.Create(fromPart, crew, OnDialogDismiss); if (crewTransfer.validParts.Contains(toPart)) { Debug.Log("[BDArmory.KerbalSafety]: Transferring " + kerbalName + " from " + fromPart + " to " + toPart + " then ejecting."); crewTransfer.MoveCrewTo(toPart); if (ProcessEjection(toPart)) { return(true); } fromPart = toPart; } } } return(false); }
public void Dismiss(CrewTransfer.DismissAction action) { if (action == CrewTransfer.DismissAction.Interrupted) ScreenMessages.PostScreenMessage(scienceTransferInterrupted, transferMessage); onDismiss(action); ScreenMessages.RemoveMessage(instructionMessage); Destroy(this); }
internal static void BeginDelayedCrewTransfer(Part source, Part destination, ProtoCrewMember crewMember) { crewTransfer = new CrewTransfer(source, destination, crewMember); }
public void Update() { if (FlightGlobals.fetch != null && FlightGlobals.ActiveVessel != null) { if (HighLogic.LoadedScene == GameScenes.FLIGHT) { //Instantiate the controller for the active vessel. ManifestController manifestController = ManifestController.GetInstance(FlightGlobals.ActiveVessel); manifestController.CanDrawButton = true; manifestController.RefreshSelectedParts(); if (crewTransfer != null) { if (Planetarium.GetUniversalTime() - crewTransfer.Initiated >= crewTransferDelay) { if (crewTransfer.Source != null && crewTransfer.Destination != null && crewTransfer.CrewMember != null) { ScreenMessages.PostScreenMessage(string.Format("{0}'s transfer complete.", crewTransfer.CrewMember.name), 2.0f, ScreenMessageStyle.UPPER_CENTER); if(!object.ReferenceEquals(crewTransfer.Source.vessel, crewTransfer.Destination.vessel)) { crewTransfer.Source.vessel.SpawnCrew(); } crewTransfer.Destination.vessel.SpawnCrew(); FireVesselUpdated(); } crewTransfer = null; } } } } }
public void transferCrew() { if (root == null) return; transfer = CrewTransfer.Create(RootPart, crew, onTransferDismiss); RootContainer.TransferActive = true; }
public void onTransferDismiss(CrewTransfer.DismissAction d) { transfer = null; RootContainer.TransferActive = false; }
internal static void BeginDelayedCrewTransfer(Part source, Part destination, ProtoCrewMember crewMember) { crewTransfer = new CrewTransfer(source, destination, crewMember); }
/// <summary> /// OnCrewTransferSelected (GameEvent Handler) /// This method captures a Stock Crew Transfer event just prior to the actual crew move. /// </summary> /// <param name="crewTransferData"></param> internal void OnCrewTransferSelected(CrewTransfer.CrewTransferData crewTransferData) { // We can skip this event if a stock CrewTransfer is enabled, Override is off & no SM Crew Transfers are active if (SMSettings.EnableStockCrewXfer && !SMSettings.OverrideStockCrewXfer && TransferCrew.CrewXferState == TransferCrew.XferState.Off) return; // Disable the stock Transfer action if SM dictates. if (!SMSettings.EnableStockCrewXfer || TransferCrew.CrewXferState != TransferCrew.XferState.Off) { if (!SMSettings.EnableStockCrewXfer) DisplayScreenMsg("SM Has Disabled Stock Crew Transfers. (Check your SM settings)"); if (TransferCrew.CrewXferState != TransferCrew.XferState.Off) DisplayScreenMsg("Stock Crew Transfer Disabled. SM Crew Transfer in Progress."); crewTransferData.canTransfer = false; return; } // If override is off, then ignore. if (!SMSettings.OverrideStockCrewXfer) return; //Check for DeepFreezer full. if full, abort handling Xfer. if (InstalledMods.IsDfInstalled && InstalledMods.IsDfApiReady && crewTransferData.destPart.Modules.Contains("DeepFreezer")) { if (new DFWrapper.DeepFreezer(crewTransferData.destPart.Modules["DeepFreezer"]).FreezerSpace == 0) { DisplayScreenMsg("Destination part is a Freezer and it is full. Aborting Transfer."); crewTransferData.canTransfer = false; return; } } // CLS is enabled and parts are not in same space. Abort Transfer. if (!SMConditions.IsClsInSameSpace(crewTransferData.sourcePart, crewTransferData.destPart)) { DisplayScreenMsg("CLS is Enabled in SM. Parts are not in Same Space. Aborting Transfer."); crewTransferData.canTransfer = false; return; }; if (!SMSettings.RealismMode) return; // OK, ealism and override are on lets manage the Crew transfer // store data from event. DisplayScreenMsg("SM is overriding Stock Transfers. SM based Crew Transfer initiating..."); SmVessel.TransferCrewObj.FromPart = crewTransferData.sourcePart; SmVessel.TransferCrewObj.ToPart = crewTransferData.destPart; SmVessel.TransferCrewObj.FromCrewMember = crewTransferData.crewMember; SmVessel.TransferCrewObj.IsStockXfer = true; crewTransferData.canTransfer = false; }