예제 #1
0
        public void EngineStuckOn()
        {
            //Make sure we're in failure mode
            if (qualityControl.currentQuality > 0)
            {
                qualityControl.currentQuality           = 0;
                BARISScenario.Instance.onTimeTickEvent += failureModeTimeTick;
                qualityControl.SendPartBrokenEmail();
            }

            //Make sure we have the active engine.
            getCurrentEngine();

            failureMode   = BARRISEngineFailureModes.StuckOn;
            failureModeID = (int)failureMode;

            isStuckOn              = true;
            engine.allowShutdown   = false;
            engine.currentThrottle = 1.0f;
            engine.finalThrust     = engine.maxThrust;
            engine.throttleLocked  = true;

            qualityControl.UpdateQualityDisplay(qualityControl.qualityDisplay + " Throttle Stuck");
            if (this.part.vessel == FlightGlobals.ActiveVessel)
            {
                string message = Localizer.Format(this.part.partInfo.title + BARISScenario.EngineStuckOn);
                BARISScenario.Instance.LogPlayerMessage(message);
            }
        }
예제 #2
0
        public void ShutdownEngine()
        {
            //Make sure we're in failure mode
            if (qualityControl.currentQuality > 0)
            {
                qualityControl.currentQuality           = 0;
                BARISScenario.Instance.onTimeTickEvent += failureModeTimeTick;
                qualityControl.SendPartBrokenEmail();
            }

            //Make sure we have the active engine.
            getCurrentEngine();

            failureMode   = BARRISEngineFailureModes.Shutdown;
            failureModeID = (int)failureMode;

            engine.Shutdown();
            engine.currentThrottle = 0;

            qualityControl.UpdateQualityDisplay(qualityControl.qualityDisplay + " Shutdown");
            if (this.part.vessel == FlightGlobals.ActiveVessel)
            {
                string message = Localizer.Format(this.part.partInfo.title + BARISScenario.EngineShutdown);
                BARISScenario.Instance.LogPlayerMessage(message);
            }
        }
예제 #3
0
        /// <summary>
        /// This method is used to apply a particular failure mode. Mostly it's used internally, but it's exposed as a public method for diagnistic purposes.
        /// </summary>
        /// <param name="mode">A BARISEngineFailureModes enumerator containing the failure mode to process.</param>
        public void ApplyFailureMode(BARRISEngineFailureModes mode = BARRISEngineFailureModes.None)
        {
            //Make sure we have the active engine.
            getCurrentEngine();

            switch (mode)
            {
            case BARRISEngineFailureModes.StuckOn:
                engine.allowShutdown   = false;
                engine.currentThrottle = 1.0f;
                engine.finalThrust     = engine.maxThrust;
                engine.throttleLocked  = true;
                break;

            case BARRISEngineFailureModes.Shutdown:
                if (EngineIsRunning)
                {
                    engine.Shutdown();
                    engine.currentThrottle = 0;
                }
                break;

            case BARRISEngineFailureModes.ReducedThrust:
                engine.currentThrottle = failureThrustPercent;
                engine.finalThrust    *= failureThrustPercent;
                break;

            default:
                break;
            }
        }
예제 #4
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            //Setup the engines
            setupEngines();

            //Failure mode
            failureMode = (BARRISEngineFailureModes)failureModeID;
            if (failureMode != BARRISEngineFailureModes.None)
            {
                BARISScenario.Instance.onTimeTickEvent += failureModeTimeTick;
            }
        }
예제 #5
0
        public void OnPartFixed(BaseQualityControl moduleQualityControl)
        {
            ModuleEngines[] engines = multiModeEngines.Values.ToArray();

            //Restore engine state
            isStuckOn = false;

            for (int index = 0; index < engines.Length; index++)
            {
                engines[index].currentThrottle = FlightInputHandler.state.mainThrottle;
                engines[index].allowShutdown   = allowShutdown[index];
                engines[index].throttleLocked  = throttleLocked[index];
            }

            //Reset failure mode
            failureMode   = BARRISEngineFailureModes.None;
            failureModeID = 0;
            BARISScenario.Instance.onTimeTickEvent -= failureModeTimeTick;
        }