コード例 #1
0
        public override void OnStart(StartState start)
        {
            base.OnStart(start);
            Fields["isShielded"].guiActive = false;

            Fields["Cl"].guiActive = Fields["Cd"].guiActive = Fields["Cm"].guiActive = false;
            if (HighLogic.LoadedSceneIsFlight && vessel.isActiveVessel)
            {
                activeControlSys = this;
                statusOverrideTimer = 0;
                vessel.OnFlyByWire += new FlightInputCallback(StabilityAugmentation);
            }
            OnVesselPartsChange += GetNavball;
            invKerbinSLDensity = 1 / FARAeroUtil.GetCurrentDensity(FlightGlobals.Bodies[1], 0);
        }
コード例 #2
0
 public void OnDestroy()
 {
     if (start != StartState.Editor)
     {
         activeControlSys = null;
         if(vessel)
             vessel.OnFlyByWire -= new FlightInputCallback(StabilityAugmentation);
     }
 }
コード例 #3
0
 public void OnDestroy()
 {
     if (activeControlSys == this)
     {
         vessel.OnFlyByWire -= new FlightInputCallback(StabilityAugmentation);
     }
     activeControlSys = null;
 }
コード例 #4
0
        public override void FixedUpdate()
        {
            if (HighLogic.LoadedSceneIsFlight && part)
            {
                if (vessel.isActiveVessel)
                {
                    if ((object)activeControlSys == null)
                    {
                        activeControlSys = this;
                        statusOverrideTimer = 0;
                    }

                    if (activeControlSys == this)
                    {
                        if (vessel.staticPressure > 0)
                        {
                            double soundspeed;
                            double density = FARAeroUtil.GetCurrentDensity(vessel, out soundspeed);
                            MachNumber = this.vessel.srf_velocity.magnitude / soundspeed;

                            if (DensityRelative)
                                AirDensity = (density * invKerbinSLDensity).ToString("F3");
                            else
                                AirDensity = (density).ToString("F3");

                            q = density * vessel.srf_velocity.sqrMagnitude * 0.5;

                            mach = MachNumber.ToString("F3");
                        }
                        else
                        {
                            q = 0;
                            mach = "0.000";
                            AirDensity = "0.000";
                        }

                        timeSinceSave++;

                    }
                }
                else if (activeControlSys == this)
                    activeControlSys = null;
            }
        }
コード例 #5
0
        public static bool SetActiveControlSysAndStabilitySystem(Vessel vesselToChangeTo, Vessel vesselToChangeFrom)
        {
            if ((object)vesselToChangeFrom != null && (object)activeControlSys != null)
            {
                vesselToChangeFrom.OnFlyByWire -= new FlightInputCallback(StabilityAugmentation);
            }

            foreach (Part p in vesselToChangeTo.Parts)
                if (p.Modules.Contains("FARControlSys"))
                {
                    activeControlSys = p.Modules["FARControlSys"] as FARControlSys;
                    break;
                }
            if ((object)activeControlSys == null)
            {
                return false;
            }
            statusOverrideTimer = 0;
            vesselToChangeTo.OnFlyByWire += new FlightInputCallback(StabilityAugmentation);

            return true;
        }