public virtual void Update() { if (!(ullageSet is Ullage.UllageSet && ShowPropStatus)) { return; } if (HighLogic.LoadedSceneIsEditor && !(part.PartActionWindow is UIPartActionWindow)) { return; } if (HighLogic.LoadedSceneIsEditor && pressureFed) { ullageSet.EditorPressurized(); } if (pressureFed && !ullageSet.PressureOK()) { propellantStatus = "<color=red>Needs high pressure tanks</color>"; } else if (HighLogic.LoadedSceneIsFlight && ullage && RFSettings.Instance.simulateUllage) { propellantStatus = ullageSet.GetUllageState(out Color ullageColor); part.stackIcon.SetIconColor(ullageColor); } else { propellantStatus = pressureFed ? "Feed pressure OK" : "Nominal"; } }
public virtual void Update() { if (!(ullageSet is Ullage.UllageSet && ShowPropStatus)) { return; } if (HighLogic.LoadedSceneIsEditor && !(part.PartActionWindow is UIPartActionWindow)) { return; } if (HighLogic.LoadedSceneIsEditor && pressureFed) { ullageSet.EditorPressurized(); } if (pressureFed && !ullageSet.PressureOK()) { propellantStatus = "<color=red>Needs high pressure tanks</color>"; } else if (HighLogic.LoadedSceneIsFlight && ullage && RFSettings.Instance.simulateUllage) { propellantStatus = ullageSet.GetUllageState(out Color ullageColor); part.stackIcon.SetIconColor(ullageColor); } else { propellantStatus = pressureFed ? "Feed pressure OK" : "Nominal"; } //if (HighLogic.LoadedSceneIsEditor) //{ // // set ignitionThreshold based on propellant set, for MJ // foreach (Propellant p in propellants) // { // p.totalResourceCapacity * // } //} //else if (HighLogic.LoadedSceneIsFlight) //{ // // set ignitionThreshold based on propellant set, for MJ // ignitionThreshold //} }
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"; } } }
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); }