示例#1
0
        private void FindAttachedThermalSource()
        {
            partDistance = 0;

            // first look if part contains an thermal source
            myAttachedReactor = part.FindModulesImplementing <IThermalSource>().FirstOrDefault();
            if (myAttachedReactor != null)
            {
                return;
            }

            // otherwise look for other non selfcontained thermal sources
            var source = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, (p) => p.IsThermalSource && p.ThermalEnergyEfficiency > 0, 3, 0, true);

            //var source = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, 3, 0, true);
            if (source == null)
            {
                return;
            }

            // verify cost is not higher than 1
            partDistance = (int)Math.Max(Math.Ceiling(source.Cost) - 1, 0);
            if (partDistance > 0)
            {
                return;
            }

            myAttachedReactor = source.Source;
        }
示例#2
0
        public void OnEditorAttach()
        {
            // first look if part itself contains an energysource
            foreach (var module in part.Modules)
            {
                var thermalsource = module as IThermalSource;

                if (thermalsource != null)
                {
                    myAttachedReactor = thermalsource;
                    break;
                }
            }

            if (myAttachedReactor == null)
            {
                List <IThermalSource> source_list = part.attachNodes.Where(atn => atn.attachedPart != null).SelectMany(atn => atn.attachedPart.FindModulesImplementing <IThermalSource>()).ToList();
                myAttachedReactor = source_list.FirstOrDefault(s => !s.IsSelfContained); //  prevent connecting to self contained sources
            }

            if (myAttachedReactor != null && myAttachedReactor is IChargedParticleSource && (myAttachedReactor as IChargedParticleSource).ChargedParticleRatio > 0)
            {
                generatorType       = altUpgradedName;
                chargedParticleMode = true;
            }
        }
示例#3
0
        public override void OnStart(PartModule.StartState state)
        {
            String[] resources_to_supply = { FNResourceManager.FNRESOURCE_MEGAJOULES, FNResourceManager.FNRESOURCE_WASTEHEAT };
            this.resources_to_supply = resources_to_supply;
            base.OnStart(state);
            generatorType = originalName;
            if (state == StartState.Editor)
            {
                if (this.HasTechsRequiredToUpgrade())
                {
                    isupgraded         = true;
                    hasrequiredupgrade = true;
                    upgradePartModule();
                }
                part.OnEditorAttach += OnEditorAttach;
                return;
            }

            if (this.HasTechsRequiredToUpgrade())
            {
                hasrequiredupgrade = true;
            }

            this.part.force_activate();


            anim = part.FindModelAnimators(animName).FirstOrDefault();
            if (anim != null)
            {
                anim [animName].layer = 1;
                if (!IsEnabled)
                {
                    anim [animName].normalizedTime = 1f;
                    anim [animName].speed          = -1f;
                }
                else
                {
                    anim [animName].normalizedTime = 0f;
                    anim [animName].speed          = 1f;
                }
                anim.Play();
            }

            if (generatorInit == false)
            {
                generatorInit = true;
                IsEnabled     = true;
            }

            if (isupgraded)
            {
                upgradePartModule();
            }

            List <IThermalSource> source_list = part.attachNodes.Where(atn => atn.attachedPart != null).SelectMany(atn => atn.attachedPart.FindModulesImplementing <IThermalSource>()).ToList();

            myAttachedReactor = source_list.FirstOrDefault();
            print("[KSP Interstellar] Configuring Generator");
        }
        public override void OnFixedUpdate()
        {
            nuclear_power         = 0;
            solar_power           = 0;
            displayed_solar_power = 0;

            base.OnFixedUpdate();
            if (IsEnabled && !relay)
            {
                foreach (FNGenerator generator in generators)
                {
                    if (generator.isActive())
                    {
                        IThermalSource thermal_source = generator.getThermalSource();
                        if (thermal_source != null && !thermal_source.IsVolatileSource)
                        {
                            float output = generator.getMaxPowerOutput();
                            if (thermal_source is InterstellarFusionReactor)
                            {
                                InterstellarFusionReactor fusion_reactor = thermal_source as InterstellarFusionReactor;
                                output = output * 0.92f;
                            }
                            output = output * transmitPower / 100.0f;
                            float gpower = consumeFNResource(output * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                            nuclear_power += gpower * 1000 / TimeWarp.fixedDeltaTime;
                        }
                    }
                }

                foreach (ModuleDeployableSolarPanel panel in panels)
                {
                    float output = panel.flowRate;

                    // attempt to retrieve all solar power output
                    if (output == 0.0)
                    {
                        var solarpanels = panel.part.parent.FindModulesImplementing <ModuleDeployableSolarPanel>();
                        solarpanels.ForEach(s => output += s.flowRate);
                    }

                    float  spower          = part.RequestResource("ElectricCharge", output * TimeWarp.fixedDeltaTime);
                    double inv_square_mult = Math.Pow(Vector3d.Distance(FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBIN].transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2) / Math.Pow(Vector3d.Distance(vessel.transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2);
                    displayed_solar_power += spower / TimeWarp.fixedDeltaTime;
                    //scale solar power to what it would be in Kerbin orbit for file storage
                    solar_power += (float)(spower / TimeWarp.fixedDeltaTime / inv_square_mult);
                }
            }

            if (double.IsInfinity(nuclear_power) || double.IsNaN(nuclear_power))
            {
                nuclear_power = 0;
            }

            if (double.IsInfinity(solar_power) || double.IsNaN(solar_power))
            {
                solar_power = 0;
            }
        }
示例#5
0
        public void OnEditorAttach()
        {
            List <IThermalSource> source_list = part.attachNodes.Where(atn => atn.attachedPart != null).SelectMany(atn => atn.attachedPart.FindModulesImplementing <IThermalSource>()).ToList();

            myAttachedReactor = source_list.FirstOrDefault();
            if (myAttachedReactor != null && myAttachedReactor is IChargedParticleSource && (myAttachedReactor as IChargedParticleSource).ChargedParticleRatio > 0)
            {
                generatorType       = altUpgradedName;
                chargedParticleMode = true;
            }
        }
示例#6
0
        /// <summary>
        /// Finds the nearest avialable thermalsource and update effective part mass
        /// </summary>
        public void FindAndAttachToThermalSource()
        {
            partDistance = 0;

            // disconnect
            if (attachedThermalSource != null)
            {
                if (chargedParticleMode)
                {
                    attachedThermalSource.ConnectedChargedParticleElectricGenerator = null;
                }
                else
                {
                    attachedThermalSource.ConnectedThermalElectricGenerator = null;
                }
            }

            // first look if part contains an thermal source
            attachedThermalSource = part.FindModulesImplementing <IThermalSource>().FirstOrDefault();
            if (attachedThermalSource != null)
            {
                return;
            }

            // otherwise look for other non selfcontained thermal sources
            var searchResult = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, (p) => p.IsThermalSource && p.ThermalEnergyEfficiency > 0, 3, 0, true);

            if (searchResult == null)
            {
                return;
            }

            // verify cost is not higher than 1
            partDistance = (int)Math.Max(Math.Ceiling(searchResult.Cost) - 1, 0);
            if (partDistance > 0)
            {
                return;
            }

            // update attached thermalsource
            attachedThermalSource = searchResult.Source;

            //connect with source
            if (chargedParticleMode)
            {
                attachedThermalSource.ConnectedChargedParticleElectricGenerator = this;
            }
            else
            {
                attachedThermalSource.ConnectedThermalElectricGenerator = this;
            }

            UpdateTargetMass();
        }
        public override void OnStart(PartModule.StartState state)
        {
            engineType = originalName;
            // check whether we have the technologies available to be able to perform an upgrade
            if (state == StartState.Editor)
            {
                if (this.HasTechsRequiredToUpgrade())
                {
                    isupgraded = true;
                    upgradePartModule();
                }
                return;
            }
            fuel_gauge       = part.stackIcon.DisplayInfo();
            myAttachedEngine = this.part.Modules["ModuleEnginesFX"] as ModuleEnginesFX;
            // if engine isn't already initialised, initialise it
            if (engineInit == false)
            {
                engineInit = true;
            }
            // if we can upgrade, let's do so
            if (isupgraded && isJet)
            {
                upgradePartModule();
            }
            else
            {
                propellants = getPropellants(isJet);
            }
            // find attached thermal source
            foreach (AttachNode attach_node in part.attachNodes)
            {
                if (attach_node.attachedPart != null)
                {
                    List <IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing <IThermalSource> ();
                    if (sources.Count > 0)
                    {
                        myAttachedReactor = sources.First();
                        if (myAttachedReactor != null)
                        {
                            break;
                        }
                    }
                }
            }

            setupPropellants();
            hasstarted = true;

            //print ("Start Complete");
        }
示例#8
0
 public void OnEditorAttach()
 {
     foreach (AttachNode attach_node in part.attachNodes)
     {
         if (attach_node.attachedPart != null)
         {
             List <IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing <IThermalSource>();
             if (sources.Count > 0)
             {
                 myAttachedReactor = sources.First();
                 if (myAttachedReactor != null)
                 {
                     break;
                 }
             }
         }
     }
     estimateEditorPerformance();
 }
示例#9
0
        /// <summary>
        /// Finds the nearest avialable thermalsource and update effective part mass
        /// </summary>
        public void FindAndAttachToThermalSource()
        {
            partDistance = 0;

            // first look if part contains an thermal source
            attachedThermalSource = part.FindModulesImplementing <IThermalSource>().FirstOrDefault();
            if (attachedThermalSource != null)
            {
                return;
            }

            // otherwise look for other non selfcontained thermal sources
            var searchResult = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, (p) => p.IsThermalSource && p.ThermalEnergyEfficiency > 0, 3, 0, true);

            if (searchResult == null)
            {
                return;
            }

            // verify cost is not higher than 1
            partDistance = (int)Math.Max(Math.Ceiling(searchResult.Cost) - 1, 0);
            if (partDistance > 0)
            {
                return;
            }

            // update attached thermalsource
            attachedThermalSource = searchResult.Source;

            // verify if mass calculation is active
            if (!calculatedMass)
            {
                return;
            }

            // update part mass
            effectiveMass = attachedThermalSource.RawMaximumPower > 0 && rawPowerToMassDivider > 0
                ? (massModifier * attachedThermalSource.ThermalProcessingModifier * attachedThermalSource.RawMaximumPower) / rawPowerToMassDivider
                : part.mass;
            part.mass = effectiveMass;
        }
        private void FindAttachedThermalSource()
        {
            foreach (AttachNode attach_node in part.attachNodes)
            {
                if (attach_node.attachedPart == null)
                {
                    continue;
                }

                List <IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing <IThermalSource>();

                if (sources.Count <= 0)
                {
                    continue;
                }

                myAttachedReactor = sources.First();

                if (myAttachedReactor != null)
                {
                    break;
                }
            }
        }
示例#11
0
        private void FindAttachedThermalSource()
        {
            partDistance = 0;

            // first look if part contains an thermal source
            myAttachedReactor = part.FindModulesImplementing<IThermalSource>().FirstOrDefault();
            if (myAttachedReactor != null) return;

            // otherwise look for other non selfcontained thermal sources
            var source = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, (p) => p.IsThermalSource && p.ThermalEnergyEfficiency > 0 , 3, 0, true);
            //var source = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, 3, 0, true);
            if (source == null) return;

            // verify cost is not higher than 1
            partDistance = (int)Math.Max(Math.Ceiling(source.Cost) - 1, 0);
            if (partDistance > 0) return;

            myAttachedReactor = source.Source;
        }
        /// <summary>
        /// Finds the nearest avialable thermalsource and update effective part mass
        /// </summary>
        public void FindAndAttachToThermalSource()
        {
            partDistance = 0;

            // first look if part contains an thermal source
            attachedThermalSource = part.FindModulesImplementing<IThermalSource>().FirstOrDefault();
            if (attachedThermalSource != null) return;

            // otherwise look for other non selfcontained thermal sources
            var searchResult = ThermalSourceSearchResult.BreadthFirstSearchForThermalSource(part, (p) => p.IsThermalSource && p.ThermalEnergyEfficiency > 0 , 3, 0, true);
            if (searchResult == null) return;

            // verify cost is not higher than 1
            partDistance = (int)Math.Max(Math.Ceiling(searchResult.Cost) - 1, 0);
            if (partDistance > 0) return;

            // update attached thermalsource
            attachedThermalSource = searchResult.Source;

            // verify if mass calculation is active
            if (!calculatedMass) return;

            // update part mass
            effectiveMass = attachedThermalSource.RawMaximumPower > 0 && rawPowerToMassDivider > 0
                ? (massModifier * attachedThermalSource.ThermalProcessingModifier * attachedThermalSource.RawMaximumPower) / rawPowerToMassDivider
                : part.mass;
            part.mass = effectiveMass;
        }
        private void FindAttachedThermalSource()
        {
            foreach (AttachNode attach_node in part.attachNodes)
            {
                if (attach_node.attachedPart == null) continue;

                List<IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing<IThermalSource>();

                if (sources.Count <= 0) continue;

                myAttachedReactor = sources.First();

                if (myAttachedReactor != null) break;
            }
        }
		public override void OnStart(PartModule.StartState state) {
            engineType = originalName;
            // check whether we have the technologies available to be able to perform an upgrade
            if (state == StartState.Editor) {
                if (this.HasTechsRequiredToUpgrade())
                {
                    isupgraded = true;
                    upgradePartModule();
                }
                return;
            }
			fuel_gauge = part.stackIcon.DisplayInfo();
			myAttachedEngine = this.part.Modules["ModuleEnginesFX"] as ModuleEnginesFX;
			// if engine isn't already initialised, initialise it
			if (engineInit == false) {
				engineInit = true;
			}
			// if we can upgrade, let's do so
			if (isupgraded && isJet) {
				upgradePartModule ();
			} else {
				propellants = getPropellants (isJet);
			}
			// find attached thermal source
			foreach (AttachNode attach_node in part.attachNodes) {
				if (attach_node.attachedPart != null) {
					List<IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing<IThermalSource> ();
					if (sources.Count > 0) {
						myAttachedReactor = sources.First ();
						if (myAttachedReactor != null) {
							break;
						}
					}
				}
			}

			setupPropellants();
			hasstarted = true;

			//print ("Start Complete");
		}
示例#15
0
 public void OnEditorAttach() {
     List<IThermalSource> source_list = part.attachNodes.Where(atn => atn.attachedPart != null).SelectMany(atn => atn.attachedPart.FindModulesImplementing<IThermalSource>()).ToList();
     myAttachedReactor = source_list.FirstOrDefault();
     if (myAttachedReactor != null && myAttachedReactor is IChargedParticleSource && (myAttachedReactor as IChargedParticleSource).ChargedParticleRatio > 0)
     {
         generatorType = altUpgradedName;
         chargedParticleMode = true;
     }
 }
示例#16
0
		public override void OnStart(PartModule.StartState state) {
			String[] resources_to_supply = {FNResourceManager.FNRESOURCE_MEGAJOULES,FNResourceManager.FNRESOURCE_WASTEHEAT};
			this.resources_to_supply = resources_to_supply;
			base.OnStart (state);
            generatorType = originalName;
            if (state == StartState.Editor) {
                if (this.HasTechsRequiredToUpgrade())
                {
                    isupgraded = true;
                    hasrequiredupgrade = true;
                    upgradePartModule();
                }
                part.OnEditorAttach += OnEditorAttach;
                return;
            }

            if (this.HasTechsRequiredToUpgrade())
            {
                hasrequiredupgrade = true;
            }

			this.part.force_activate();
			

			anim = part.FindModelAnimators (animName).FirstOrDefault ();
			if (anim != null) {
				anim [animName].layer = 1;
				if (!IsEnabled) {
					anim [animName].normalizedTime = 1f;
					anim [animName].speed = -1f;

				} else {
					anim [animName].normalizedTime = 0f;
					anim [animName].speed = 1f;

				}
				anim.Play ();
			}

			if (generatorInit == false) {
				generatorInit = true;
				IsEnabled = true;
			}

			if (isupgraded) {
				upgradePartModule ();
			}

            List<IThermalSource> source_list = part.attachNodes.Where(atn => atn.attachedPart != null).SelectMany(atn => atn.attachedPart.FindModulesImplementing<IThermalSource>()).ToList();
            myAttachedReactor = source_list.FirstOrDefault();
			print("[KSP Interstellar] Configuring Generator");
		}
 public void OnEditorAttach() {
     foreach (AttachNode attach_node in part.attachNodes) {
         if (attach_node.attachedPart != null) {
             List<IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing<IThermalSource>();
             if (sources.Count > 0) {
                 myAttachedReactor = sources.First();
                 if (myAttachedReactor != null) {
                     break;
                 }
             }
         }
     }
     estimateEditorPerformance();
 }
示例#18
0
 public ThermalSourceSearchResult(IThermalSource source, float cost)
 {
     Cost   = cost;
     Source = source;
 }
示例#19
0
        public override void OnStart(PartModule.StartState state)
        {
            engineType       = originalName;
            myAttachedEngine = this.part.Modules["ModuleEngines"] as ModuleEngines;
            // find attached thermal source
            foreach (AttachNode attach_node in part.attachNodes)
            {
                if (attach_node.attachedPart != null)
                {
                    List <IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing <IThermalSource>();
                    if (sources.Count > 0)
                    {
                        myAttachedReactor = sources.First();
                        if (myAttachedReactor != null)
                        {
                            break;
                        }
                    }
                }
            }

            if (state == StartState.Editor)
            {
                part.OnEditorAttach += OnEditorAttach;
                propellants          = getPropellants(isJet);
                if (this.HasTechsRequiredToUpgrade() && isJet)
                {
                    isupgraded = true;
                    upgradePartModule();
                }
                setupPropellants();
                estimateEditorPerformance();
                return;
            }
            fuel_gauge = part.stackIcon.DisplayInfo();

            // if engine isn't already initialised, initialise it
            if (engineInit == false)
            {
                engineInit = true;
            }
            // if we can upgrade, let's do so
            if (isupgraded && isJet)
            {
                upgradePartModule();
            }
            else
            {
                if (this.HasTechsRequiredToUpgrade() && isJet)
                {
                    hasrequiredupgrade = true;
                }
                // if not, use basic propellants
                propellants = getPropellants(isJet);
            }

            setupPropellants();
            hasstarted = true;

            //print ("Start Complete");
        }
 public ThermalSourceSearchResult(IThermalSource source, float cost)
 {
     Cost = cost;
     Source = source;
 }
		public override void OnStart(PartModule.StartState state) {
            engineType = originalName;
            myAttachedEngine = this.part.Modules["ModuleEngines"] as ModuleEngines;
            // find attached thermal source
            foreach (AttachNode attach_node in part.attachNodes) {
                if (attach_node.attachedPart != null) {
                    List<IThermalSource> sources = attach_node.attachedPart.FindModulesImplementing<IThermalSource>();
                    if (sources.Count > 0) {
                        myAttachedReactor = sources.First();
                        if (myAttachedReactor != null) {
                            break;
                        }
                    }
                }
            }

            if (state == StartState.Editor) {
                part.OnEditorAttach += OnEditorAttach;
                propellants = getPropellants(isJet);
                if (this.HasTechsRequiredToUpgrade() && isJet)
                {
                    isupgraded = true;
                    upgradePartModule();
                }
                setupPropellants();
                estimateEditorPerformance();
                return;
            }
			fuel_gauge = part.stackIcon.DisplayInfo();
			
            // if engine isn't already initialised, initialise it
			if (engineInit == false) {
				engineInit = true;
			}
			// if we can upgrade, let's do so
			if (isupgraded && isJet) {
				upgradePartModule ();
			} else {
                if (this.HasTechsRequiredToUpgrade() && isJet)
                {
                    hasrequiredupgrade = true;
                }
				// if not, use basic propellants
				propellants = getPropellants (isJet);
			}
			
			setupPropellants();
			hasstarted = true;

			//print ("Start Complete");
		}
        public override void OnFixedUpdate()
        {
            activeCount++;
            nuclear_power         = 0;
            solar_power           = 0;
            displayed_solar_power = 0;
            if (IsEnabled && !relay)
            {
                foreach (FNGenerator generator in generators)
                {
                    if (generator.isActive())
                    {
                        IThermalSource thermal_source = generator.getThermalSource();
                        if (thermal_source != null && !thermal_source.IsVolatileSource)
                        {
                            double output = generator.getMaxPowerOutput();
                            if (thermal_source is InterstellarFusionReactor)
                            {
                                output = output * 0.95;
                            }
                            output = output * transmitPower / 100.0;
                            double gpower = consumeFNResource(output * TimeWarp.fixedDeltaTime, FNResourceManager.FNRESOURCE_MEGAJOULES);
                            nuclear_power += gpower * 1000 / TimeWarp.fixedDeltaTime;
                        }
                    }
                }

                foreach (ModuleDeployableSolarPanel panel in panels)
                {
                    double output          = panel.flowRate;
                    double spower          = part.RequestResource("ElectricCharge", output * TimeWarp.fixedDeltaTime);
                    double inv_square_mult = Math.Pow(Vector3d.Distance(FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBIN].transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2) / Math.Pow(Vector3d.Distance(vessel.transform.position, FlightGlobals.Bodies[PluginHelper.REF_BODY_KERBOL].transform.position), 2);
                    displayed_solar_power += spower / TimeWarp.fixedDeltaTime;
                    //scale solar power to what it would be in Kerbin orbit for file storage
                    solar_power += spower / TimeWarp.fixedDeltaTime / inv_square_mult;
                }
            }

            if (double.IsInfinity(nuclear_power) || double.IsNaN(nuclear_power))
            {
                nuclear_power = 0;
            }

            if (double.IsInfinity(solar_power) || double.IsNaN(solar_power))
            {
                solar_power = 0;
            }

            if (activeCount % 1000 == 9)
            {
                ConfigNode config   = PluginHelper.getPluginSaveFile();
                string     vesselID = vessel.id.ToString();
                if (config.HasNode("VESSEL_MICROWAVE_POWER_" + vesselID))
                {
                    ConfigNode power_node = config.GetNode("VESSEL_MICROWAVE_POWER_" + vesselID);
                    if (power_node.HasValue("nuclear_power"))
                    {
                        power_node.SetValue("nuclear_power", MicrowavePowerTransmitter.getEnumeratedNuclearPowerForVessel(vessel).ToString("E"));
                    }
                    else
                    {
                        power_node.AddValue("nuclear_power", MicrowavePowerTransmitter.getEnumeratedNuclearPowerForVessel(vessel).ToString("E"));
                    }
                    if (power_node.HasValue("solar_power"))
                    {
                        power_node.SetValue("solar_power", MicrowavePowerTransmitter.getEnumeratedSolarPowerForVessel(vessel).ToString("E"));
                    }
                    else
                    {
                        power_node.AddValue("solar_power", MicrowavePowerTransmitter.getEnumeratedSolarPowerForVessel(vessel).ToString("E"));
                    }
                }
                else
                {
                    ConfigNode power_node = config.AddNode("VESSEL_MICROWAVE_POWER_" + vesselID);
                    power_node.AddValue("nuclear_power", MicrowavePowerTransmitter.getEnumeratedNuclearPowerForVessel(vessel).ToString("E"));
                    power_node.AddValue("solar_power", MicrowavePowerTransmitter.getEnumeratedSolarPowerForVessel(vessel).ToString("E"));
                }

                if (config.HasNode("VESSEL_MICROWAVE_RELAY_" + vesselID))
                {
                    ConfigNode relay_node = config.GetNode("VESSEL_MICROWAVE_RELAY_" + vesselID);
                    if (relay_node.HasValue("relay"))
                    {
                        relay_node.SetValue("relay", MicrowavePowerTransmitter.vesselIsRelay(vessel).ToString());
                    }
                    else
                    {
                        relay_node.AddValue("relay", MicrowavePowerTransmitter.vesselIsRelay(vessel).ToString());
                    }
                }
                else
                {
                    ConfigNode relay_node = config.AddNode("VESSEL_MICROWAVE_RELAY_" + vesselID);
                    relay_node.AddValue("relay", MicrowavePowerTransmitter.vesselIsRelay(vessel).ToString());
                }

                config.Save(PluginHelper.getPluginSaveFilePath());
            }
            activeCount++;
        }