void ChangeIspAndThrust(EngineModuleInfo engine, double adjustment, double fuelAdjustment = -1) { engine.moduleEngineFX.atmosphereCurve = new FloatCurve(); engine.moduleEngineFX.atmosphereCurve.Add(0f, (float)(engine.GetIsp(0) * adjustment)); engine.moduleEngineFX.atmosphereCurve.Add(1f, (float)(engine.origAtmosphereCurve.Evaluate(1f) * adjustment)); engine.moduleEngineFX.atmosphereCurve.Add(4f, (float)(engine.origAtmosphereCurve.Evaluate(4f) * adjustment)); fuelAdjustment = Math.Max(adjustment, fuelAdjustment); engine.moduleEngineFX.maxFuelFlow = engine.origMaxFuelFlow * (float)Math.Pow(Math.Max(1, fuelAdjustment), 2); }
// Finds ModuleEnginesFX void FindEngineModules(Part part) { bool multiMode = part.Modules.Contains <MultiModeEngine>(); bool anyNukes = false; int engineModuleCnt = 0; foreach (PartModule mod in part.Modules) { if (mod.moduleName == "ModuleEnginesFX") { engineModuleCnt++; var mfx = mod as ModuleEnginesFX; if (mfx.engineType == EngineType.Nuclear) { anyNukes = true; } } } if (anyNukes && (engineModuleCnt == 1 || multiMode)) { foreach (PartModule mod in part.Modules) { if (mod.moduleName == "ModuleEnginesFX") { var mfx = mod as ModuleEnginesFX; //if (mfx.engineType == EngineType.Nuclear) { EngineModuleInfo ei = new EngineModuleInfo(mfx, maxIncreasedThrustPercentage); engineModules.Add(ei); } } } } }