Beispiel #1
0
 //Cuts the chute if it's deployed
 protected override void FailPart()
 {
     if (chute == null)
     {
         return;
     }
     if (chute.vessel != FlightGlobals.ActiveVessel)
     {
         return;
     }
     if (chute.deploymentState == ModuleParachute.deploymentStates.SEMIDEPLOYED || chute.deploymentState == ModuleParachute.deploymentStates.DEPLOYED)
     {
         chute.CutParachute();
     }
     if (OhScrap.highlight)
     {
         OhScrap.SetFailedHighlight();
     }
     if (message)
     {
         return;
     }
     message     = true;
     postMessage = true;
     if (vessel.vesselType != VesselType.Debris)
     {
         ScreenMessages.PostScreenMessage("Parachute Failure!");
     }
     Debug.Log("[OhScrap]: " + SYP.ID + " parachute has failed");
 }
Beispiel #2
0
 protected override void FailPart()
 {
     chute = part.FindModuleImplementing <ModuleParachute>();
     if (chute == null)
     {
         return;
     }
     if (chute.vessel != FlightGlobals.ActiveVessel)
     {
         return;
     }
     if (chute.deploymentState == ModuleParachute.deploymentStates.SEMIDEPLOYED || chute.deploymentState == ModuleParachute.deploymentStates.DEPLOYED)
     {
         chute.CutParachute();
     }
     if (UPFM.highlight)
     {
         UPFM.SetFailedHighlight();
     }
     if (message)
     {
         return;
     }
     message     = true;
     postMessage = true;
     ScreenMessages.PostScreenMessage("Parachute Failure!");
     Debug.Log("[UPFM]: " + SYP.ID + " parachute has failed");
 }
Beispiel #3
0
 public void FixedUpdate()
 {
     if (enableAutoCut && HighLogic.LoadedSceneIsFlight && parachute != null)
     {
         if (parachute.deploymentState == ModuleParachute.deploymentStates.DEPLOYED)
         {
             //Check cut altitude
             if (this.part.vessel.altitude <= cutAltitude)
             {
                 parachute.CutParachute();
             }
         }
     }
 }
Beispiel #4
0
    void UnEject()
    {
        if (ejection.canopyObject)
        {
            ejection.canopyObject.GetComponentInChildren <Collider>().enabled          = false;
            ejection.canopyObject.GetComponentInChildren <Collider>().gameObject.layer = 9;//set to debris layer
        }
        ejection.gameObject.GetComponentInChildren <Collider>().enabled          = false;
        ejection.gameObject.GetComponentInChildren <Collider>().gameObject.layer = 9;//set to debris layer

        if (ejection.canopyObject)
        {
            Destroy(ejection.canopyObject.GetComponent <Rigidbody>());
            Destroy(ejection.canopyObject.GetComponent <FloatingOriginTransform>());

            ejection.canopyObject.transform.parent        = canopyParent;
            ejection.canopyObject.transform.localPosition = canopyPos;
            ejection.canopyObject.transform.localRotation = canopyRot;
        }

        BlackoutEffect componentInChildren = VRHead.instance.GetComponentInChildren <BlackoutEffect>();

        if (componentInChildren)
        {
            componentInChildren.rb            = GetComponent <Rigidbody>();
            componentInChildren.useFlightInfo = true;
        }
        ejection.gameObject.transform.parent = ejectorParent;
        ejection.transform.localPosition     = ejectorSeatPos;
        ejection.transform.localRotation     = ejectorSeatRot;

        Destroy(ejection.gameObject.GetComponent <FloatingOriginShifter>());
        Destroy(ejection.gameObject.GetComponent <FloatingOriginTransform>());
        ejection.seatRB.isKinematic            = true;
        ejection.seatRB.interpolation          = RigidbodyInterpolation.None;
        ejection.seatRB.collisionDetectionMode = CollisionDetectionMode.Discrete;

        ModuleParachute parachute = ejection.GetComponentInChildren <ModuleParachute>();

        parachute.CutParachute();

        Traverse.Create(ejection).Field("ejected").SetValue(false);//does nothing, cannot eject a seccond time
        //i dont think ejecting is necessary for now, but someone prob ought look into that

        //shifter.enabled = true;
        //AudioController.instance.AddExteriorOpening("eject", 0f);
    }
 //Cuts the chute if it's deployed
 public override void FailPart()
 {
     if (chute == null)
     {
         return;
     }
     if (OhScrap.highlight)
     {
         OhScrap.SetFailedHighlight();
     }
     if (chute.vessel != FlightGlobals.ActiveVessel)
     {
         return;
     }
     if (chute.deploymentState == ModuleParachute.deploymentStates.SEMIDEPLOYED || chute.deploymentState == ModuleParachute.deploymentStates.DEPLOYED)
     {
         chute.CutParachute();
     }
 }
Beispiel #6
0
 //============================================================================================================================================
 public void EngageChute()
 {
     //FAR Compatibility =)
     if (assemblyFARUsed == true) {
         foreach (Part EnabledPart in EnabledPartList) {
             if (EnabledPart.Modules.Contains ("RealChuteFAR")) {
                 //FerramAerospaceResearch.RealChuteLite.RealChuteFAR RCF = new FerramAerospaceResearch.RealChuteLite.RealChuteFAR ();
                 //RCF = EnabledPart.FindModuleImplementing<FerramAerospaceResearch.RealChuteLite.RealChuteFAR> ();
                 ChuteFARModuleReference = EnabledPart.Modules ["RealChuteFAR"];
                 PropertyInfo ChuteFARModuleDeploymentState = ChuteFARModuleReference.GetType().GetProperty("deploymentState");
                 RoboBrakes_ParaEnabledCount++;
                 ChuteFARDeploymentString = ChuteFARModuleReference.Fields.GetValue ("depState").ToString ();
                 //Repack if Chute was already Cut
                 if ((ChuteFARDeploymentString == "CUT") && (IsLanded == false) && (RoboBrakes_CHUTEAUTO == true)) {
                     //Bypassing RealChutes Repacking Method so we don't have to EVA - Also we can't set 'canRepack' bool as it is read only :-/
                     ChuteFARModuleDeploymentState.SetValue(ChuteFARModuleReference, 1, null);
                     ChuteFARModuleReference.part.Effect ("rcrepack");
                     ChuteFARModuleReference.part.stackIcon.SetIconColor (XKCDColors.White);
                     ChuteFARModuleReference.part.DragCubes.SetCubeWeight ("PACKED", 1);
                     ChuteFARModuleReference.part.DragCubes.SetCubeWeight ("RCDEPLOYED", 0);
                     print ("ROBOBRAKES - RealChute " + EnabledPart.name + " was already Cut! Repacked Automatically!");
                 }
                 //Deploy Chute
                 if ((RoboBrakes_CHUTEREADY == true && RoboBrakes_CHUTEAUTO == true)) {
                     RoboBrakes_CHUTEREADY = false;
                     //Deploy Real Chute
                     ChuteFARModuleReference.SendMessage("ActivateRC");
                 }
                 //Repack Chute Automatically
                 if (ChuteFARDeploymentString == "DEPLOYED" | ChuteFARDeploymentString == "PREDEPLOYED") {
                     if (RoboBrakes_CUTCHUTE == true) {
                         RoboBrakes_CUTCHUTE = false;
                         //Cut Real Chute
                         ChuteFARModuleReference.SendMessage("Cut");
                         //Bypassing RealChutes Repacking Method so we don't have to EVA - Also we can't set 'canRepack' bool as it is read only :-/
                         ChuteFARModuleDeploymentState.SetValue(ChuteFARModuleReference, 1, null);
                         ChuteFARModuleReference.part.Effect ("rcrepack");
                         ChuteFARModuleReference.part.stackIcon.SetIconColor (XKCDColors.White);
                         ChuteFARModuleReference.part.DragCubes.SetCubeWeight ("PACKED", 1);
                         ChuteFARModuleReference.part.DragCubes.SetCubeWeight ("RCDEPLOYED", 0);
                         print ("ROBOBRAKES - RealChute " + EnabledPart.name + " was Cut & Repacked Automatically!");
                     }
                 }
             }
         }
     }
     foreach (Part EnabledPart in EnabledPartList) {
         //Module Parachutes
         //---------------------------------------------------------------------------------------------------------------------
         if (EnabledPart.Modules.Contains ("ModuleParachute")) {
             ModuleParachute MPA = new ModuleParachute ();
             MPA = EnabledPart.FindModuleImplementing<ModuleParachute> ();
             RoboBrakes_ParaEnabledCount++;
             //Repack the Chute automatically if it has been manually cut
             if ((MPA.deploymentState.Equals (ModuleParachute.deploymentStates.CUT)) && (IsLanded == false) && (RoboBrakes_CHUTEAUTO == true)) {
                 MPA.Repack ();
                 print ("ROBOBRAKES - Chute " + EnabledPart.name + " was already Cut! Repacked Automatically!");
             }
             //Deploy Chute
             if ((RoboBrakes_AUTOMATICBRAKE_ACTIVE == true && RoboBrakes_CHUTEAUTO == true)) {
                 if (RoboBrakes_CHUTEREADY == true) {
                     RoboBrakes_CHUTEREADY = false;
                     MPA.Deploy ();
                 }
             }
             //Repack Chute
             if (MPA.deploymentState.Equals (ModuleParachute.deploymentStates.DEPLOYED)) {
                 if (RoboBrakes_CUTCHUTE == true) {
                     RoboBrakes_CUTCHUTE = false;
                     MPA.CutParachute ();
                     MPA.Repack ();
                     print ("ROBOBRAKES - Chute " + EnabledPart.name + " was Cut & Repacked Automatically!");
                 }
             }
         }
     }
 }