public void CreateEngineSims(List<EngineSim> allEngines, double atmosphere, double velocity, bool vectoredThrust, LogMsg log) { bool correctThrust = SimManager.DoesEngineUseCorrectedThrust(part); if (log != null) { log.buf.AppendLine("CreateEngineSims for " + name); foreach (PartModule partMod in part.Modules) { log.buf.AppendLine("Module: " + partMod.moduleName); } log.buf.AppendLine("correctThrust = " + correctThrust); } if (hasMultiModeEngine) { // A multi-mode engine has multiple ModuleEnginesFX but only one is active at any point // The mode of the engine is the engineID of the ModuleEnginesFX that is active string mode = part.GetModule<MultiModeEngine>().mode; foreach (ModuleEnginesFX engine in part.GetModules<ModuleEnginesFX>()) { if (engine.engineID == mode) { if (log != null) log.buf.AppendLine("Module: " + engine.moduleName); Vector3 thrustvec = CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log); EngineSim engineSim = new EngineSim(this, atmosphere, velocity, engine.maxThrust, engine.minThrust, engine.thrustPercentage, engine.requestedThrust, thrustvec, engine.realIsp, engine.atmosphereCurve, engine.useVelocityCurve ? engine.velocityCurve : null, engine.throttleLocked, engine.propellants, engine.isOperational, correctThrust); allEngines.Add(engineSim); } } } else { if (hasModuleEnginesFX) { foreach (ModuleEnginesFX engine in part.GetModules<ModuleEnginesFX>()) { if (log != null) log.buf.AppendLine("Module: " + engine.moduleName); Vector3 thrustvec = CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log); EngineSim engineSim = new EngineSim(this, atmosphere, velocity, engine.maxThrust, engine.minThrust, engine.thrustPercentage, engine.requestedThrust, thrustvec, engine.realIsp, engine.atmosphereCurve, engine.useVelocityCurve ? engine.velocityCurve : null, engine.throttleLocked, engine.propellants, engine.isOperational, correctThrust); allEngines.Add(engineSim); } } if (hasModuleEngines) { foreach (ModuleEngines engine in part.GetModules<ModuleEngines>()) { if (log != null) log.buf.AppendLine("Module: " + engine.moduleName); Vector3 thrustvec = CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log); EngineSim engineSim = new EngineSim(this, atmosphere, velocity, engine.maxThrust, engine.minThrust, engine.thrustPercentage, engine.requestedThrust, thrustvec, engine.realIsp, engine.atmosphereCurve, engine.useVelocityCurve ? engine.velocityCurve : null, engine.throttleLocked, engine.propellants, engine.isOperational, correctThrust); allEngines.Add(engineSim); } } } if (log != null) log.Flush(); }
public void CreateEngineSims(List <EngineSim> allEngines, double atmosphere, double velocity, bool vectoredThrust, LogMsg log) { bool correctThrust = SimManager.DoesEngineUseCorrectedThrust(part); if (log != null) { log.buf.AppendLine("CreateEngineSims for " + name); foreach (PartModule partMod in part.Modules) { log.buf.AppendLine("Module: " + partMod.moduleName); } log.buf.AppendLine("correctThrust = " + correctThrust); } if (hasMultiModeEngine) { // A multi-mode engine has multiple ModuleEnginesFX but only one is active at any point // The mode of the engine is the engineID of the ModuleEnginesFX that is active string mode = part.GetModule <MultiModeEngine>().mode; foreach (ModuleEnginesFX engine in part.GetModules <ModuleEnginesFX>()) { if (engine.engineID == mode) { if (log != null) { log.buf.AppendLine("Module: " + engine.moduleName); } Vector3 thrustvec = CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log); EngineSim engineSim = new EngineSim(this, atmosphere, velocity, engine.maxThrust, engine.minThrust, engine.thrustPercentage, engine.requestedThrust, thrustvec, engine.realIsp, engine.atmosphereCurve, engine.useVelocityCurve ? engine.velocityCurve : null, engine.throttleLocked, engine.propellants, engine.isOperational, correctThrust); allEngines.Add(engineSim); } } } else { if (hasModuleEnginesFX) { foreach (ModuleEnginesFX engine in part.GetModules <ModuleEnginesFX>()) { if (log != null) { log.buf.AppendLine("Module: " + engine.moduleName); } Vector3 thrustvec = CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log); EngineSim engineSim = new EngineSim(this, atmosphere, velocity, engine.maxThrust, engine.minThrust, engine.thrustPercentage, engine.requestedThrust, thrustvec, engine.realIsp, engine.atmosphereCurve, engine.useVelocityCurve ? engine.velocityCurve : null, engine.throttleLocked, engine.propellants, engine.isOperational, correctThrust); allEngines.Add(engineSim); } } if (hasModuleEngines) { foreach (ModuleEngines engine in part.GetModules <ModuleEngines>()) { if (log != null) { log.buf.AppendLine("Module: " + engine.moduleName); } Vector3 thrustvec = CalculateThrustVector(vectoredThrust ? engine.thrustTransforms : null, log); EngineSim engineSim = new EngineSim(this, atmosphere, velocity, engine.maxThrust, engine.minThrust, engine.thrustPercentage, engine.requestedThrust, thrustvec, engine.realIsp, engine.atmosphereCurve, engine.useVelocityCurve ? engine.velocityCurve : null, engine.throttleLocked, engine.propellants, engine.isOperational, correctThrust); allEngines.Add(engineSim); } } } if (log != null) { log.Flush(); } }