internal override void Toggle()
 {
     if (!GetState())
     {
         if (action == ActionType.Toggle || action == ActionType.Activate)
         {
             decoupleModule.Decouple();
         }
     }
 }
 public void DecoupleAction(KSPActionParam param)
 {
     if (param.group == KSPActionGroup.Abort)
     {
         decoupler.Decouple();
     }
     else
     {
         Decouple();
     }
 }
Example #3
0
        public override void OnUpdate()
        {
            if (!HighLogic.LoadedSceneIsFlight || !autoJettison)
            {
                return;
            }

            if (decoupler != null && !decoupler.isDecoupled)
            {
                double g = part.vessel.geeForce;
                geeForceDisplay = g;
                if (g < geeForce)
                {
                    gTime = Planetarium.GetUniversalTime();
                }
                else if (gTime + 0.25 < Planetarium.GetUniversalTime())
                {
                    decoupler.Decouple();
                    ModuleEngines e = part.FindModuleImplementing <ModuleEngines>();
                    if (e != null)
                    {
                        e.Activate();
                    }
                }
            }
        }
Example #4
0
        public override void Jettison()
        {
            if (_targetDecoupler == null || !_targetDecoupler || !(_targetDecoupler is IStageSeparator))
            {
                return;
            }


            ModuleDecouple decouple = _targetDecoupler as ModuleDecouple;

            if (decouple != null)
            {
                decouple.ejectionForce *= 5;
                decouple.Decouple();
            }
            else
            {
                ((ModuleAnchoredDecoupler)_targetDecoupler).ejectionForce *= 5;
                ((ModuleAnchoredDecoupler)_targetDecoupler).Decouple();
            }

            if (BDArmorySetup.Instance.ActiveWeaponManager != null)
            {
                BDArmorySetup.Instance.ActiveWeaponManager.UpdateList();
            }
        }
Example #5
0
 public void Decouple ()
 {
     if (decoupler != null)
         decoupler.Decouple ();
     else
         anchoredDecoupler.Decouple ();
 }
Example #6
0
        public void DoJettison()
        {
            Debug.Log(string.Format("{0}: {1}: {2}", _myModTag, part.name, "Do Jettison!"));

            if (_lesDecoupler != null)
            {
                try
                {
                    _lesDecoupler.Decouple();
                }
                catch (System.Exception x)
                {
                    Debug.LogError(string.Format("{0} ERROR: {1}", _myModTag, x.Message));
                }
            }
            else
            {
                Debug.LogError(string.Format("{0}: {1}: {2}", _myModTag, part.name, "Did not find a decoupler on the LES!"));
            }

            ActivateJettisonEngine();

            Debug.Log(string.Format("{0} LES jettisoned", _myModTag));
            hasJettisoned = true;
        }
Example #7
0
        public void Decoupler()
        {
            decoupler.Decouple();

            //Reset the decoupler so we can reuse it.
            decoupler.isDecoupled = false;
            decoupler.staged      = false;
        }
Example #8
0
 internal void Decouple()
 {
     if (_escapeDecoupler != null)
     {
         _escapeDecoupler.Decouple();
         Debug.Log(string.Format("{0} LES decoupled from CM", _myModTag));
     }
 }
Example #9
0
        private void decoupleByModule(int index)
        {
            ModuleDecouple d = (ModuleDecouple)part.Modules[index];

            if (!d.isDecoupled)
            {
                d.Decouple();
            }
        }
Example #10
0
 public void Decouple()
 {
     if (decoupler != null)
     {
         decoupler.isEnabled      = true;
         decoupler.enabled        = true;
         decoupler.stagingEnabled = true;
         decoupler.Decouple();
     }
 }
Example #11
0
 public void Decouple()
 {
     if (decoupler != null)
     {
         decoupler.Decouple();
     }
     else
     {
         anchoredDecoupler.Decouple();
     }
 }
Example #12
0
        private void decoupleByModule(int index)
        {
            ModuleDecouple d = part.Modules[index] as ModuleDecouple;

            if (d == null)
            {
                MonoBehaviour.print("ERROR: No decoupler found at module index: " + index);
            }
            else if (!d.isDecoupled)
            {
                d.Decouple();
            }
        }
Example #13
0
 public void FixedUpdate()
 {
     if (remainingDelay > 0)
     {
         remainingDelay -= TimeWarp.fixedDeltaTime;
         if (remainingDelay <= 0)
         {
             if (!isDecoupled)
             {
                 Decouple();
             }
             if (!decoupler.isDecoupled)
             {
                 decoupler.Decouple();
             }
         }
     }
     else if (autoDecouple && engineModule.flameout)
     {
         if (autoDecoupleDelay > 0)
         {
             remainingDelay = autoDecoupleDelay;
         }
         else
         {
             if (!isDecoupled)
             {
                 Decouple();
             }
             if (!decoupler.isDecoupled)
             {
                 decoupler.Decouple();
             }
         }
     }
 }
 public void Decouple()
 {
     OnMoving.Fire(0, 1);
     if (decoupler != null && !decoupler.isDecoupled)
     {
         decoupler.Decouple();
     }
     foreach (ModuleDecouple d in panels)
     {
         if (!d.isDecoupled)
         {
             d.Decouple();
         }
     }
     OnStop.Fire(1);
 }
Example #15
0
        public void FixedUpdate() // Clean this up and use OnVesselWasModified to catch decouple by other means
        {
            foreach (var anim in animationStates)
            {
                if (anim.normalizedTime >= 1)
                {
                    anim.speed          = 0;
                    anim.normalizedTime = 1;
                }

                if (HighLogic.LoadedSceneIsFlight && !decoupled && decoupler != null && decoupler.isDecoupled)
                {
                    decoupled = true;
                    PlayAnimation(1);
                }

                if (anim.normalizedTime < 0)
                {
                    anim.speed          = 0;
                    anim.normalizedTime = 0;
                }
                animPosition = anim.normalizedTime;
                animSpeed    = anim.speed;
            }

            if (HighLogic.LoadedSceneIsFlight && animPosition >= waitForAnimation && animSpeed > 0)
            {
                if (decoupler != null && !decoupler.isDecoupled)
                {
                    decoupler.Decouple();
                }
                decoupled = true;
                if (payloadDecoupler != null)
                {
                    payloadDecoupler.isEnabled = true;
                }
            }

            if (playing && animSpeed == 0f)
            {
                playing = false;
                OnStop.Fire(animPosition);
            }
        }
Example #16
0
        public Vessel Decouple()
        {
            if (Decoupled)
            {
                throw new InvalidOperationException("Decoupler has already fired");
            }

            var preVesselIds = FlightGlobals.Vessels.Select(v => v.id).ToList();

            // Fire the decoupler
            if (decoupler != null)
            {
                decoupler.Decouple();
            }
            else
            {
                anchoredDecoupler.Decouple();
            }

            return(PostDecouple(preVesselIds));
        }
 public void drop()
 {
     part.vessel.DiscoveryInfo.SetLevel(DiscoveryLevels.Unowned);
     decouple.Decouple();
 }
 public void drop()
 {
     decouple.Decouple();
 }
 public void drop()
 {
     armMine = true;
     decouple.Decouple();
 }