public override void Start() { base.Start(); if (ullageSet == null) ullageSet = new Ullage.UllageSet(this); Fields["ignitions"].guiActive = Fields["ignitions"].guiActiveEditor = (ignitions >= 0 && RFSettings.Instance.limitedIgnitions); Fields["propellantStatus"].guiActive = Fields["propellantStatus"].guiActiveEditor = (pressureFed || (ullage && RFSettings.Instance.simulateUllage)); igniteFailIgnitions = new ScreenMessage("<color=orange>[" + part.partInfo.title + "]: no ignitions remaining!</color>", 5f, ScreenMessageStyle.UPPER_CENTER); igniteFailResources = new ScreenMessage("<color=orange>[" + part.partInfo.title + "]: insufficient resources to ignite!</color>", 5f, ScreenMessageStyle.UPPER_CENTER); ullageFail = new ScreenMessage("<color=orange>[" + part.partInfo.title + "]: vapor in feedlines, shut down!</color>", 5f, ScreenMessageStyle.UPPER_CENTER); }
public override void OnLoad(ConfigNode node) { if (thrustCurve == null) thrustCurve = new FloatCurve(); base.OnLoad(node); // Manually reload ignitions if not in editor if(!HighLogic.LoadedSceneIsEditor) node.TryGetValue("ignited", ref ignited); int pCount = propellants.Count; // thrust curve useThrustCurve = false; if (node.HasNode("thrustCurve") && node.HasValue("curveResource")) { if (node.GetValue("curveResource") != curveResource) { Debug.Log("*RFE* ERROR: curveResource doesn't match node's!"); curveResource = node.GetValue("curveResource"); } if (thrustCurve == null) { Debug.Log("*RFE* ERROR: have curve node but thrustCurve is null!"); thrustCurve = new FloatCurve(); thrustCurve.Load(node.GetNode("thrustCurve")); } if (curveResource != "") { for (int i = 0; i < pCount; ++i) { if (propellants[i].name.Equals(curveResource)) { curveProp = i; break; } } if (curveProp != -1) { useThrustCurve = true; } } } // Set from propellants bool instantThrottle = false; for (int i = 0; i < pCount; ++i) { if (RFSettings.Instance.instantThrottleProps.Contains(propellants[i].name)) { instantThrottle = true; } // any other stuff } // FIXME calculating throttle change rate if (!instantThrottle) { if (throttleResponseRate <= 0f) throttleResponseRate = (float)(10d / Math.Log(Math.Max(1.1, Math.Sqrt(part.mass * maxThrust * maxThrust)))); } else throttleResponseRate = 1000000f; minThrottle = minFuelFlow / maxFuelFlow; // set fields Fields["thrustCurveDisplay"].guiActive = useThrustCurve; CreateEngine(); if (ullageSet == null) ullageSet = new Ullage.UllageSet(this); // Get thrust axis (only on create prefabs) if (part.partInfo == null || part.partInfo.partPrefab == null) { thrustAxis = Vector3.zero; foreach(Transform t in part.FindModelTransforms(thrustVectorTransformName)) { thrustAxis -= t.forward; } thrustAxis = thrustAxis.normalized; } ullageSet.SetThrustAxis(thrustAxis); // ullage if (node.HasNode("Ullage")) { ullageSet.Load(node.GetNode("Ullage")); } ullageSet.SetUllageEnabled(ullage); // load ignition resources if (node.HasNode("IGNITOR_RESOURCE")) ignitionResources.Clear(); foreach (ConfigNode n in node.GetNodes("IGNITOR_RESOURCE")) { ModuleResource res = new ModuleResource(); res.Load(n); ignitionResources.Add(res); } }