void process_active_engine(EngineWrapper e) { e.throttle = e.VSF = e.thrustMod = 1; e.UpdateThrustInfo(); e.InitLimits(); e.InitTorque(EditorLogic.RootPart.transform, CoM, EngineOptimizer.C.TorqueRatioFactor); e.UpdateCurrentTorque(1); }
bool UpdateEngines(ShipConstruct ship) { Engines.Clear(); var thrust = Vector3.zero; Mass = DryMass = MinTWR = MaxTWR = 0f; ship.GetShipMass(out DryMass, out Mass); Mass += DryMass; if (TCAScenario.HasTCA && ship.Parts != null) { (from p in ship.Parts where p.Modules != null from m in p.Modules.GetModules <ModuleEngines>() select m) .ForEach(m => { var e = new EngineWrapper(m); Engines.Add(e); e.UpdateThrustInfo(); if (CFG != null) { var ecfg = CFG.ActiveProfile.GetConfig(e); if (ecfg == null || ecfg.On) { thrust += e.wThrustDir * e.thrustInfo.thrust; } } }); var T = thrust.magnitude / Utils.G0; MinTWR = T / Mass; MaxTWR = T / DryMass; } var ret = Engines.Count > 0; if (!ret) { Reset(); } return(ret); }