Esempio n. 1
0
        // Returns the Operational Time or the time, in MET, since the last time the part was fully functional.
        // If a part is currently in a failure state, return will be -1 and the part should not fail again
        // This counts from mission start time until a failure, at which point it is reset to the time the
        // failure is repaired.  It is important to understand this is NOT the total flight time of the part.
        public static float GetOperatingTime(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(0);
            }

            return(core.GetOperatingTime());
        }
Esempio n. 2
0
        public static float ForceRepair(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(-1);
            }

            return(core.ForceRepair());
        }
Esempio n. 3
0
        // Cause a failure to occur, either a random failure or a specific one
        // If fallbackToRandom is true, then if the specified failure can't be found or can't be triggered, a random failure will be triggered instead
        public static void TriggerFailure(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return;
            }

            core.TriggerFailure();
        }
Esempio n. 4
0
        public static void DisableFailure(Part part, String failureModuleName)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return;
            }

            core.DisableFailure(failureModuleName);
        }
Esempio n. 5
0
        // Returns the total engineer bonus for the current vessel's current crew based on the given part's desired per engineer level bonus
        public static float GetEngineerDataBonus(Part part, float partEngineerBonus)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(1);
            }

            return(core.GetEngineerDataBonus(partEngineerBonus));
        }
Esempio n. 6
0
        public static float ModifyFlightTime(Part part, float modifier, bool additive)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(0);
            }

            return(core.ModifyFlightTime(modifier, additive));
        }
Esempio n. 7
0
        public static float SetDataCap(Part part, float cap)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(float.MaxValue);
            }

            return(core.SetDataCap(cap));
        }
Esempio n. 8
0
        public static bool IsPartOperating(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(false);
            }

            return(core.IsPartOperating());
        }
        public static double GetRepairTime(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(-1);
            }

            return(core.GetRepairTime());
        }
Esempio n. 10
0
        // Get the base or static failure rate
        public static double GetBaseFailureRate(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(TestFlightUtil.MIN_FAILURE_RATE);
            }

            return(core.GetBaseFailureRate());
        }
Esempio n. 11
0
        public static double ModifyFlightTimeForScope(Part part, double modifier, String scope, bool additive)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(0);
            }

            return(core.ModifyFlightTimeForScope(modifier, scope, additive));
        }
Esempio n. 12
0
        public static double SetDataRateLimit(Part part, double limit)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(1);
            }

            return(core.SetDataRateLimit(limit));
        }
Esempio n. 13
0
        public static double SetDataCap(Part part, double cap)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(double.MaxValue);
            }

            return(core.SetDataCap(cap));
        }
Esempio n. 14
0
        public static double SetTriggerMomentaryFailureModifierForScope(Part part, String trigger, double multiplier, PartModule owner, String scope)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(TestFlightUtil.MIN_FAILURE_RATE);
            }

            return(core.SetTriggerMomentaryFailureModifierForScope(trigger, multiplier, owner, scope));
        }
Esempio n. 15
0
        public static double GetFlightTimeForScope(Part part, String scope)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(0);
            }

            return(core.GetFlightTimeForScope(scope));
        }
Esempio n. 16
0
        public static FloatCurve GetBaseReliabilityCurveForScope(Part part, String scope)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(null);
            }

            return(core.GetBaseReliabilityCurveForScope(scope));
        }
Esempio n. 17
0
        public static double GetMomentaryFailureRateForTriggerForScope(Part part, String trigger, String scope)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(TestFlightUtil.MIN_FAILURE_RATE);
            }

            return(core.GetMomentaryFailureRateForTriggerForScope(trigger, scope));
        }
Esempio n. 18
0
        public static string GetRequirementsTooltip(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return("");
            }

            return(core.GetRequirementsTooltip());
        }
Esempio n. 19
0
        public static float GetMaximumFlightData(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(0);
            }

            return(core.GetMaximumData());
        }
Esempio n. 20
0
        /// <summary>
        /// 0 = OK, 1 = Minor Failure, 2 = Failure, 3 = Major Failure, -1 = Could not find TestFlight Core on Part
        /// </summary>
        /// <returns>The part status.</returns>
        public static int GetPartStatus(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(-1);
            }

            return(core.GetPartStatus());
        }
Esempio n. 21
0
        // Simply converts the failure rate to a MTBF number, without any string formatting
        public static double FailureRateToMTBF(Part part, string alias, double failureRate, int units)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part, alias);

            if (core == null)
            {
                failureRate = Math.Max(failureRate, TestFlightUtil.MIN_FAILURE_RATE);
                double mtbfSeconds = 1.0f / failureRate;
                return(mtbfSeconds);
            }

            return(core.FailureRateToMTBF(failureRate, (TestFlightUtil.MTBFUnits)units));
        }
Esempio n. 22
0
        // PART methods
        // These API methods all operate on a specific part, and therefore the first parameter is always the Part to which it should be applied

        public static bool TestFlightAvailable(Part part)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 23
0
        public static double GetBestMomentaryFailureRate(Part part, string alias)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part, alias);

            if (core == null)
            {
                return(-1);
            }

            MomentaryFailureRate mfr = core.GetBestMomentaryFailureRate();

            if (mfr.valid)
            {
                return(mfr.failureRate);
            }
            else
            {
                return(-1);
            }
        }
Esempio n. 24
0
        public static double GetWorstMomentaryFailureRateForScope(Part part, String scope)
        {
            ITestFlightCore core = TestFlightInterface.GetCore(part);

            if (core == null)
            {
                return(-1);
            }

            MomentaryFailureRate mfr;

            mfr = core.GetWorstMomentaryFailureRateForScope(scope);
            if (mfr.valid)
            {
                return(mfr.failureRate);
            }
            else
            {
                return(-1);
            }
        }