public void SetAllValues(AbortValues a)
        {
            if (a != null)
            {
                this.armed = a.armed;

                this.vertSpeedTriggerEnabled = a.vertSpeedTriggerEnabled;
                this.vertSpeed = a.vertSpeed;

                this.gForceTriggerEnabled = a.gForceTriggerEnabled;
                this.gForceTrigger        = a.gForceTrigger;

                this.exceedingAoA = a.exceedingAoA;
                this.maxAoA       = a.maxAoA;

                this.explosiveTriggerEnabled  = a.explosiveTriggerEnabled;
                this.disableAfter             = a.disableAfter;
                this.actionAfterTimeout       = a.actionAfterTimeout;
                this.disableAtAltitudeKm      = a.disableAtAltitudeKm;
                this.disableAtAltitude        = a.disableAtAltitudeKm * 1000;
                this.ignoreAoAAboveAltitudeKm = a.ignoreAoAAboveAltitudeKm;
                this.ignoreAoAAboveAltitude   = a.ignoreAoAAboveAltitudeKm * 1000;
                this.maxTimeoutActionG        = a.maxTimeoutActionG;
                this.postAbortAction          = a.postAbortAction;
                this.postAbortDelay           = a.postAbortDelay;
                this.delayPostAbortUntilSafe  = a.delayPostAbortUntilSafe;
                av = a;
            }
        }
        new void Start()
        {
            av = new AbortValues();

            // SetAllValues(av);
            Start2();
            base.Start();

            //CheckAbortActionGroup.getAllActions();
        }
Beispiel #3
0
 public void SetAllValues(AbortValues a)
 {
     if (a != null)
     {
         av = (AbortValues)a.Clone();
         foreach (var p in EditorLogic.fetch.ship.parts)
         {
             var m = p.FindModuleImplementing <Module_BobsPanicBox>();
             if (m != null)
             {
                 m.SetAllValues(av);
             }
         }
     }
 }
Beispiel #4
0
 public void SetAllValues(Vessel vessel, AbortValues a)
 {
     if (a != null)
     {
         av = (AbortValues)a.Clone();
         foreach (var p in vessel.parts)
         {
             var m = p.FindModuleImplementing <Module_BobsPanicBox>();
             if (m != null)
             {
                 m.SetAllValues(av);
             }
         }
     }
 }
        public void SetAllValues(AbortValues av)
        {
            if (av != null)
            {
                this.vertSpeedTriggerEnabled = av.vertSpeedTriggerEnabled;
                this.vertSpeed = av.vertSpeed;

                this.gForceTriggerEnabled = av.gForceTriggerEnabled;
                this.gForceTrigger        = av.gForceTrigger;

                this.exceedingAoA = av.exceedingAoA;
                this.maxAoA       = av.maxAoA;

                this.explosiveTriggerEnabled  = av.explosiveTriggerEnabled;
                this.disableAfter             = av.disableAfter;
                this.actionAfterTimeout       = av.actionAfterTimeout;
                this.disableAtAltitudeKm      = av.disableAtAltitudeKm;
                this.disableAtAltitude        = av.disableAtAltitudeKm * 1000;
                this.ignoreAoAAboveAltitudeKm = av.ignoreAoAAboveAltitudeKm;
                this.ignoreAoAAboveAltitude   = av.ignoreAoAAboveAltitudeKm * 1000;
                this.maxTimeoutActionG        = av.maxTimeoutActionG;
                this.postAbortAction          = av.postAbortAction;
                this.postAbortDelay           = av.postAbortDelay;
                this.delayPostAbortUntilSafe  = av.delayPostAbortUntilSafe;

                List <Part> parts;
                if (HighLogic.LoadedSceneIsEditor)
                {
                    parts = EditorLogic.fetch.ship.parts;
                }
                else
                {
                    parts = FlightGlobals.ActiveVessel.Parts;
                }


                foreach (var p in parts)
                {
                    var m = p.FindModuleImplementing <Module_BobsPanicBox>();
                    if (m != null)
                    {
                        m.SetAllValues(av);
                    }
                }
            }
        }
 internal void EnableWindow(AbortValues a)
 {
     if (!visible)
     {
         abortValues = (AbortValues)a.Clone();
         visible     = true;
         if (HighLogic.LoadedSceneIsEditor)
         {
             curSceneStr = "Editor";
         }
         else
         {
             curSceneStr = "Flight";
         }
     }
     else
     {
         CloseWindow();
     }
 }
 public bool Changed(AbortValues m)
 {
     return(armed != m.armed ||
            status != m.status ||
            vertSpeedTriggerEnabled != m.vertSpeedTriggerEnabled ||
            vertSpeed != m.vertSpeed ||
            gForceTriggerEnabled != m.gForceTriggerEnabled ||
            gForceTrigger != m.gForceTrigger ||
            explosiveTriggerEnabled != m.explosiveTriggerEnabled ||
            disableAfter != m.disableAfter ||
            exceedingAoA != m.exceedingAoA ||
            maxAoA != m.maxAoA ||
            actionAfterTimeout != m.actionAfterTimeout ||
            postAbortAction != m.postAbortAction ||
            postAbortDelay != m.postAbortDelay ||
            delayPostAbortUntilSafe != m.delayPostAbortUntilSafe ||
            maxTimeoutActionG != m.maxTimeoutActionG ||
            disableAtAltitudeKm != m.disableAtAltitudeKm ||
            ignoreAoAAboveAltitudeKm != m.ignoreAoAAboveAltitudeKm);
 }
        public void SetAllValues(AbortValues a)
        {
            if (a != null)
            {
                this.armed = a.armed;
                this.vertSpeedTriggerEnabled = a.vertSpeedTriggerEnabled;
                this.vertSpeed = a.vertSpeed;

                this.gForceTriggerEnabled = a.gForceTriggerEnabled;
                this.gForceTrigger        = a.gForceTrigger;

                this.exceedingAoA = a.exceedingAoA;
                this.maxAoA       = a.maxAoA;

                this.explosiveTriggerEnabled  = a.explosiveTriggerEnabled;
                this.disableAfter             = a.disableAfter;
                this.actionAfterTimeout       = a.actionAfterTimeout;
                this.disableAtAltitudeKm      = a.disableAtAltitudeKm;
                this.disableAtAltitude        = a.disableAtAltitudeKm * 1000;
                this.ignoreAoAAboveAltitudeKm = a.ignoreAoAAboveAltitudeKm;
                this.ignoreAoAAboveAltitude   = a.ignoreAoAAboveAltitudeKm * 1000;
                this.maxTimeoutActionG        = a.maxTimeoutActionG;
                this.postAbortAction          = a.postAbortAction;
                this.postAbortDelay           = a.postAbortDelay;
                this.delayPostAbortUntilSafe  = a.delayPostAbortUntilSafe;
                av = (AbortValues)a.Clone();

                foreach (var p in this.vessel.Parts)
                {
                    var m = p.FindModuleImplementing <Module_BobsPanicBox>();
                    if (m != null)
                    {
                        m.SetAllValues(av);
                    }
                }
            }
        }
Beispiel #9
0
 internal Editor()
 {
     av = new AbortValues();
 }
Beispiel #10
0
 internal Flight()
 {
     av = new AbortValues();
 }
        void Start()
        {
            if (!HighLogic.LoadedSceneIsFlight && !HighLogic.LoadedSceneIsEditor)
            {
                return;
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                vm         = this.vessel.GetComponent <BPB_VesselModule>();
                flightInfo = new Flight();
                av         = new AbortValues(flightInfo);
                Events["openAutoAbort"].guiActive = HighLogic.CurrentGame.Parameters.CustomParams <BPB_Options>().allowChangeInFlight&& HighLogic.CurrentGame.Parameters.CustomParams <BPB_UI_Options>().pawWindow;
            }
            else
            {
                if (editorInfo == null)
                {
                    editorInfo = new Editor();
                    SetAllValues(editorInfo.av);
                }
                if (HighLogic.CurrentGame.Parameters.CustomParams <BPB_Options>().activeInVAB&& EditorDriver.editorFacility == EditorFacility.VAB)
                {
                    Events["openAutoAbort"].guiActive = HighLogic.CurrentGame.Parameters.CustomParams <BPB_Options>().activeInVAB&& HighLogic.CurrentGame.Parameters.CustomParams <BPB_UI_Options>().pawWindow;
                }
                if (HighLogic.CurrentGame.Parameters.CustomParams <BPB_Options>().activeInSPH&& EditorDriver.editorFacility == EditorFacility.SPH)
                {
                    Events["openAutoAbort"].guiActive = HighLogic.CurrentGame.Parameters.CustomParams <BPB_Options>().activeInSPH&& HighLogic.CurrentGame.Parameters.CustomParams <BPB_UI_Options>().pawWindow;
                }
                av = new AbortValues(editorInfo);
            }

            if (!initted)
            {
                if (HighLogic.LoadedSceneIsEditor)
                {
                    av = new AbortValues(flightInfo);
                    CopyOrInit();
                }
                else
                {
                    flightInfo.av.ResetToDefault();
                    SetAllValues(av);

                    flightInfo.SaveCurrent(this);
                }
                initted = true;
            }
            else
            {
                if (HighLogic.LoadedSceneIsEditor)
                {
                    editorInfo.av.armed = armed;
                    editorInfo.av.vertSpeedTriggerEnabled = vertSpeedTriggerEnabled;
                    editorInfo.av.gForceTriggerEnabled    = gForceTriggerEnabled;
                    editorInfo.av.vertSpeed                = vertSpeed;
                    editorInfo.av.exceedingAoA             = exceedingAoA;
                    editorInfo.av.maxAoA                   = maxAoA;
                    editorInfo.av.gForceTrigger            = gForceTrigger;
                    editorInfo.av.explosiveTriggerEnabled  = explosiveTriggerEnabled;
                    editorInfo.av.disableAfter             = disableAfter;
                    editorInfo.av.actionAfterTimeout       = actionAfterTimeout;
                    editorInfo.av.disableAtAltitudeKm      = disableAtAltitudeKm;
                    editorInfo.av.disableAtAltitude        = disableAtAltitudeKm * 1000;
                    editorInfo.av.ignoreAoAAboveAltitudeKm = ignoreAoAAboveAltitudeKm;
                    editorInfo.av.ignoreAoAAboveAltitude   = ignoreAoAAboveAltitudeKm * 1000;
                    editorInfo.av.maxTimeoutActionG        = maxTimeoutActionG;
                    editorInfo.av.postAbortAction          = postAbortAction;
                    editorInfo.av.postAbortDelay           = postAbortDelay;
                    editorInfo.av.delayPostAbortUntilSafe  = delayPostAbortUntilSafe;

                    SetAllValues(editorInfo.av);
                }
                else
                {
                    flightInfo.av.armed = armed;
                    flightInfo.av.vertSpeedTriggerEnabled = vertSpeedTriggerEnabled;
                    flightInfo.av.gForceTriggerEnabled    = gForceTriggerEnabled;
                    flightInfo.av.vertSpeed                = vertSpeed;
                    flightInfo.av.exceedingAoA             = exceedingAoA;
                    flightInfo.av.maxAoA                   = maxAoA;
                    flightInfo.av.gForceTrigger            = gForceTrigger;
                    flightInfo.av.explosiveTriggerEnabled  = explosiveTriggerEnabled;
                    flightInfo.av.disableAfter             = disableAfter;
                    flightInfo.av.actionAfterTimeout       = actionAfterTimeout;
                    flightInfo.av.disableAtAltitudeKm      = disableAtAltitudeKm;
                    flightInfo.av.disableAtAltitude        = disableAtAltitudeKm * 1000;
                    flightInfo.av.ignoreAoAAboveAltitudeKm = ignoreAoAAboveAltitudeKm;
                    flightInfo.av.ignoreAoAAboveAltitude   = ignoreAoAAboveAltitudeKm * 1000;
                    flightInfo.av.maxTimeoutActionG        = maxTimeoutActionG;
                    flightInfo.av.postAbortAction          = postAbortAction;
                    flightInfo.av.postAbortDelay           = postAbortDelay;
                    flightInfo.av.delayPostAbortUntilSafe  = delayPostAbortUntilSafe;
                    av = (AbortValues)flightInfo.av.Clone();
                    SetAllValues(flightInfo.av);
                    if (vm != null)
                    {
                        vm.SetAllValues(flightInfo.av);
                    }
                    else
                    {
                        Log.Info("No VesselModule found");
                    }
                    flightInfo.SaveCurrent(this);
                }
            }
        }
        public Object Clone()
        {
            AbortValues av = (AbortValues)this.MemberwiseClone();

            return(av);
        }