Exemplo n.º 1
0
        public void FindPartTemperatures()
        {
            if (activeVessel.Parts.Count != vesselPartCount)
            {
                vesselPartCount = activeVessel.Parts.Count;
                radiators.Clear();
                partTargetTemps.Clear();

                ModuleRadiator   radiator;
                ModuleTargetTemp moduleTargetTemp;
                foreach (Part part in activeVessel.Parts)
                {
                    //If the part has a radiator then add it to the radiator's list.
                    radiator = part.FindModuleImplementing <ModuleRadiator>();
                    if (radiator != null)
                    {
                        radiators.Add(radiator);
                        radiator.radiatorDestroyedDelegate = RadiatorDestroyed;
                        continue;
                    }

                    //It isn't a radiator, if it's physicsless then keep going
                    if (part.PhysicsSignificance == 1)
                    {
                        continue;
                    }

                    //Create a new PartTargetTemp
                    PartTargetTemp partTargetTemp = new PartTargetTemp();
                    partTargetTemps.Add(partTargetTemp);
                    partTargetTemp.part = part;

                    //If the part has a ModuleTargetTemp then use its temperature
                    moduleTargetTemp = part.FindModuleImplementing <ModuleTargetTemp>();
                    if (moduleTargetTemp != null)
                    {
                        partTargetTemp.targetTemp = moduleTargetTemp.targetTemperature;
                    }

                    //If the part is crewed then the target temperature is room temperature.
                    else if (part.CrewCapacity > 0)
                    {
                        partTargetTemp.targetTemp = kRoomTemperature;
                    }

                    //By default, the part will be kept at a percentage of its maximum temperature.
                    //This can be configured in the Cooldown config file
                    else
                    {
                        partTargetTemp.targetTemp = part.maxTemp * maxTempPercent;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void FindPartTemperatures()
        {
            if (activeVessel.Parts.Count != vesselPartCount)
            {
                vesselPartCount = activeVessel.Parts.Count;
                radiators.Clear();
                partTargetTemps.Clear();

                ModuleRadiator radiator;
                ModuleTargetTemp moduleTargetTemp;
                foreach (Part part in activeVessel.Parts)
                {
                    //If the part has a radiator then add it to the radiator's list.
                    radiator = part.FindModuleImplementing<ModuleRadiator>();
                    if (radiator != null)
                    {
                        radiators.Add(radiator);
                        radiator.radiatorDestroyedDelegate = RadiatorDestroyed;
                        continue;
                    }

                    //It isn't a radiator, if it's physicsless then keep going
                    if (part.PhysicsSignificance == 1)
                        continue;

                    //Create a new PartTargetTemp
                    PartTargetTemp partTargetTemp = new PartTargetTemp();
                    partTargetTemps.Add(partTargetTemp);
                    partTargetTemp.part = part;

                    //If the part has a ModuleTargetTemp then use its temperature
                    moduleTargetTemp = part.FindModuleImplementing<ModuleTargetTemp>();
                    if (moduleTargetTemp != null)
                        partTargetTemp.targetTemp = moduleTargetTemp.targetTemperature;

                    //If the part is crewed then the target temperature is room temperature.
                    else if (part.CrewCapacity > 0)
                        partTargetTemp.targetTemp = kRoomTemperature;

                    //By default, the part will be kept at a percentage of its maximum temperature.
                    //This can be configured in the Cooldown config file
                    else
                        partTargetTemp.targetTemp = part.maxTemp * maxTempPercent;
                }
            }
        }