Exemplo n.º 1
0
        // Find associated Engine module
        public ModuleSystemHeatFissionEngine FindEngineModule(Part part, string moduleName)
        {
            ModuleSystemHeatFissionEngine engine = part.GetComponents <ModuleSystemHeatFissionEngine>().ToList().Find(x => x.moduleID == moduleName);

            if (engine == null)
            {
                KSHUtils.LogError($"[{part}] No ModuleSystemHeatFissionEngine named {moduleName} was found, using first instance");
                engineModule = part.GetComponents <ModuleSystemHeatFissionEngine>().ToList().First();
            }
            if (engine == null)
            {
                KSHUtils.LogError($"[{part}] No ModuleSystemHeatFissionEngine was found.");
            }
            return(engine);
        }
        // Find associated Reactor module
        public ModuleSystemHeatFissionReactor FindReactorModule(Part part, string moduleName)
        {
            ModuleSystemHeatFissionReactor reactor = part.GetComponents <ModuleSystemHeatFissionReactor>().ToList().Find(x => x.moduleID == moduleName);

            if (reactor == null)
            {
                KSHUtils.LogError($"[{part}] No ModuleSystemHeatFissionReactor named {moduleName} was found, using first instance.");
                reactorModule = part.GetComponents <ModuleSystemHeatFissionReactor>().ToList().First();
            }
            if (reactor == null)
            {
                KSHUtils.LogError($"[{part}] No ModuleSystemHeatFissionReactor was found.");
            }
            return(reactor);
        }