GetUllageState() public method

public GetUllageState ( Color &col ) : string
col Color
return string
Ejemplo n.º 1
0
 public override void FixedUpdate()
 {
     if (HighLogic.LoadedSceneIsEditor)
     {
         if (ullageSet != null && pressureFed)
         {
             if (ullageSet.EditorPressurized()) // we need to recheck each frame. Expensive, but short of messages....
             {
                 propellantStatus = "Feed pressure OK";
             }
             else
             {
                 propellantStatus = "Feed pressure too low";
             }
         }
         else
         {
             propellantStatus = "OK";
         }
     }
     needSetPropStatus = true;
     base.FixedUpdate();
     if (needSetPropStatus && showPropStatus)
     {
         if (pressureFed && !ullageSet.PressureOK())
         {
             propellantStatus = "Feed pressure too low";
         }
         else if (ullage && RFSettings.Instance.simulateUllage)
         {
             propellantStatus = ullageSet.GetUllageState(out ullageColor);
             part.stackIcon.SetIconColor(ullageColor);
         }
         else
         {
             propellantStatus = "Nominal";
         }
     }
 }
Ejemplo n.º 2
0
        public override void UpdateFlightCondition(EngineThermodynamics ambientTherm, double altitude, Vector3d vel, double mach, bool oxygen)
        {
            throttledUp = false;

            // handle ignition
            if (HighLogic.LoadedSceneIsFlight)
            {
                if (vessel.ctrlState.mainThrottle > 0f || throttleLocked)
                {
                    throttledUp = true;
                }
                else
                {
                    ignited = false;
                }
                IgnitionUpdate();

                // Ullage
                bool pressureOK = ullageSet.PressureOK();
                propellantStatus = "Nominal";
                if (ullage)
                {
                    propellantStatus = ullageSet.GetUllageState();
                    if (EngineIgnited && ignited && throttledUp)
                    {
                        double state     = ullageSet.GetUllageStability();
                        double testValue = Math.Pow(state, RFSettings.Instance.stabilityPower);
                        if (UnityEngine.Random.value > testValue)
                        {
                            ScreenMessages.PostScreenMessage(ullageFail);
                            FlightLogger.eventLog.Add("[" + FormatTime(vessel.missionTime) + "] " + ullageFail.message);
                            reignitable = false;
                            ullageOK    = false;
                            ignited     = false;
                            Flameout("Vapor in feed line");
                        }
                    }
                }
                if (!pressureOK)
                {
                    ignited          = false;
                    reignitable      = false;
                    propellantStatus = "Feed pressure too low"; // override ullage status indicator
                    Flameout("Lack of pressure");
                }

                rfSolver.SetEngineStatus(pressureOK, ullageOK, ignited);

                // do thrust curve
                if (ignited && useThrustCurve)
                {
                    thrustCurveRatio = (float)((propellants[curveProp].totalResourceAvailable / propellants[curveProp].totalResourceCapacity));
                    if (thrustCurveUseTime)
                    {
                        thrustCurveDisplay = thrustCurve.Evaluate(curveTime);
                        if (EngineIgnited)
                        {
                            curveTime += TimeWarp.fixedDeltaTime;
                        }
                    }
                    else
                    {
                        thrustCurveDisplay = thrustCurve.Evaluate(thrustCurveRatio);
                    }
                    rfSolver.UpdateThrustRatio(thrustCurveDisplay);
                    thrustCurveDisplay *= 100f;
                }
            }

            // Set part temp
            rfSolver.SetPartTemp(part.temperature);

            // do heat
            heatProduction = (float)(scaleRecip * extHeatkW / PhysicsGlobals.InternalHeatProductionFactor * part.thermalMassReciprocal);

            // run base method code
            base.UpdateFlightCondition(ambientTherm, altitude, vel, mach, oxygen);
        }