public void UpdateModules()
        {
            for (int i = 0; i < protovessel.protoPartSnapshots.Count; i++)
            {
                ProtoPartSnapshot partsnapshot = protovessel.protoPartSnapshots[i];

                for (int j = 0; j < partsnapshot.modules.Count; j++)
                {
                    ProtoPartModuleSnapshot modulesnapshot = partsnapshot.modules[j];
                    for (int k = 0; k < UnloadedResources.InterestingModules.Count; k++)
                    {
                        if (modulesnapshot.moduleName == UnloadedResources.InterestingModules[k])
                        {
                            if (!ModuleHandlers.ContainsModule(modulesnapshot))
                            {
                                if (UnloadedResources.InterestingModules[k] == "ModuleDeployableSolarPanel" || UnloadedResources.InterestingModules[k] == "KopernicusSolarPanel")
                                {
                                    ModuleHandlers.Add(new SolarPanel(modulesnapshot.moduleValues, this, modulesnapshot, partsnapshot));
                                }
                                if (UnloadedResources.InterestingModules[k] == "ModuleGenerator")
                                {
                                    ModuleHandlers.Add(new Generator(modulesnapshot.moduleValues, this, modulesnapshot, partsnapshot));
                                }
                                if (UnloadedResources.InterestingModules[k] == "FissionGenerator")
                                {
                                    ModuleHandlers.Add(new NearFutureFissionGenerator(modulesnapshot.moduleValues, this, modulesnapshot, partsnapshot));
                                }
                                if (UnloadedResources.InterestingModules[k] == "TacGenericConverter")
                                {
                                    ModuleHandlers.Add(new TacGenericConverter(modulesnapshot.moduleValues, this, modulesnapshot, partsnapshot));
                                }
                                if (UnloadedResources.InterestingModules[k] == "ModuleResourceConverter" && ModuleResourceConverter.ResourceConverterGeneratesEC(partsnapshot))
                                {
                                    ModuleHandlers.Add(new ModuleResourceConverter(modulesnapshot.moduleValues, this, modulesnapshot, partsnapshot));
                                }
                                if (UnloadedResources.InterestingModules[k] == "DeepFreezer")
                                {
                                    ModuleHandlers.Add(new DeepFreezer(modulesnapshot.moduleValues, this, modulesnapshot, partsnapshot));
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static bool ContainsInterestedModules(ProtoVessel protoVessel)
        {
            for (int i = 0; i < protoVessel.protoPartSnapshots.Count; i++)
            {
                ProtoPartSnapshot partsnapshot = protoVessel.protoPartSnapshots[i];

                for (int j = 0; j < partsnapshot.modules.Count; j++)
                {
                    ProtoPartModuleSnapshot modulesnapshot = partsnapshot.modules[j];
                    if (UnloadedResources.InterestingModules.ContainsKey(modulesnapshot.moduleName))
                    {
                        if (modulesnapshot.moduleName == "ModuleDeployableSolarPanel" || modulesnapshot.moduleName == "KopernicusSolarPanel")
                        {
                            return(true);
                        }
                        if (modulesnapshot.moduleName == "ModuleGenerator")
                        {
                            return(true);
                        }
                        if (modulesnapshot.moduleName == "FissionGenerator")
                        {
                            return(true);
                        }
                        if (modulesnapshot.moduleName == "TacGenericConverter")
                        {
                            return(true);
                        }
                        if (modulesnapshot.moduleName == "ModuleResourceConverter" && ModuleResourceConverter.ResourceConverterGeneratesEC(partsnapshot))
                        {
                            return(true);
                        }
                        if (modulesnapshot.moduleName == "DeepFreezer")
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }