public virtual void Startup() { engines = new List <EngineHandler>(); if (!String.IsNullOrEmpty(engineID)) { if (engineID.ToLower() == "all") { List <ModuleEngines> engineMods = this.part.Modules.GetModules <ModuleEngines>(); foreach (ModuleEngines eng in engineMods) { string id = eng.engineID; EngineModuleWrapper engine = new EngineModuleWrapper(); engine.InitWithEngine(this.part, id); EngineHandler engineHandler = new EngineHandler(); engineHandler.engine = engine; engineHandler.ignitionState = engine.IgnitionState; engines.Add(engineHandler); } } else if (engineID.Contains(",")) { string[] sEngineIndices = engineID.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string sEngineIndex in sEngineIndices) { EngineModuleWrapper engine = new EngineModuleWrapper(); engine.InitWithEngine(this.part, sEngineIndex); EngineHandler engineHandler = new EngineHandler(); engineHandler.engine = engine; engineHandler.ignitionState = engine.IgnitionState; engines.Add(engineHandler); } } else { EngineModuleWrapper engine = new EngineModuleWrapper(); engine.InitWithEngine(this.part, engineID); EngineHandler engineHandler = new EngineHandler(); engineHandler.engine = engine; engineHandler.ignitionState = engine.IgnitionState; engines.Add(engineHandler); } } else { EngineModuleWrapper engine = new EngineModuleWrapper(); engine.Init(this.part); EngineHandler engineHandler = new EngineHandler(); engineHandler.engine = engine; engineHandler.ignitionState = engine.IgnitionState; engines.Add(engineHandler); } }
public override void OnStart(StartState state) { base.OnStart(state); engine = new EngineModuleWrapper(); engine.Init(this.part); }