Example #1
0
        protected void dumpCoolant(CoolantResource coolant, double dumpRate)
        {
            PartResourceDefinitionList definitions = PartResourceLibrary.Instance.resourceDefinitions;
            PartResourceDefinition     resourceDef;
            double coolantToDump        = dumpRate * TimeWarp.fixedDeltaTime;
            double coolantDumped        = 0;
            double thermalEnergyCoolant = 0;

            //The the resource definition
            resourceDef = definitions[coolant.name];

            //Now calculate the resource amount dumped and the thermal energy of that slug of resource.
            coolantDumped = this.part.RequestResource(resourceDef.id, coolantToDump * coolant.ratio, coolant.flowMode);
            if (coolantDumped <= 0.001)
            {
                if (soundClip != null)
                {
                    soundClip.audio.Stop();
                }
                showParticleEffects(false);
                ToggleCoolingMode();
                return;
            }
            thermalEnergyCoolant = this.part.temperature * this.part.resourceThermalMass * coolantDumped;

            //Practice conservation of energy...
            if (coolantDumped > 0.001)
            {
                this.part.AddThermalFlux(-thermalEnergyCoolant);
            }
        }
Example #2
0
        protected void getCoolantNodes()
        {
            if (this.part.protoPartSnapshot != null)
            {
                if (this.part.protoPartSnapshot.partInfo != null)
                {
                    //Aha! the part's config file!
                    //Now go find the MODULE definition for ModuleRadiator
                    if (this.part.protoPartSnapshot.partInfo.partConfig != null)
                    {
                        string       value;
                        ConfigNode[] moduleNodes = this.part.protoPartSnapshot.partInfo.partConfig.GetNodes("MODULE");

                        if (moduleNodes == null)
                        {
                            return;
                        }

                        //Find our module definition.
                        foreach (ConfigNode moduleNode in moduleNodes)
                        {
                            value = moduleNode.GetValue("name");
                            if (string.IsNullOrEmpty(value))
                            {
                                continue;
                            }

                            //Aha! found our module definition!
                            //Now get the coolants
                            if (value == this.ClassName)
                            {
                                CoolantResource coolant;
                                ConfigNode[]    coolantResourceNodes = moduleNode.GetNodes("INPUT_RESOURCE");
                                foreach (ConfigNode node in coolantResourceNodes)
                                {
                                    coolant          = new CoolantResource();
                                    coolant.name     = node.GetValue("name");
                                    coolant.flowMode = (ResourceFlowMode)Enum.Parse(typeof(ResourceFlowMode), node.GetValue("flowMode"));
                                    coolant.ratio    = float.Parse(node.GetValue("ratio"));
                                    coolantResources.Add(coolant);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        protected void getCoolantNodes()
        {
            if (this.part.protoPartSnapshot != null)
            {
                if (this.part.protoPartSnapshot.partInfo != null)
                {
                    //Aha! the part's config file!
                    //Now go find the MODULE definition for ModuleRadiator
                    if (this.part.protoPartSnapshot.partInfo.partConfig != null)
                    {
                        string value;
                        ConfigNode[] moduleNodes = this.part.protoPartSnapshot.partInfo.partConfig.GetNodes("MODULE");

                        if (moduleNodes == null)
                            return;

                        //Find our module definition.
                        foreach (ConfigNode moduleNode in moduleNodes)
                        {
                            value = moduleNode.GetValue("name");
                            if (string.IsNullOrEmpty(value))
                                continue;

                            //Aha! found our module definition!
                            //Now get the coolants
                            if (value == this.ClassName)
                            {
                                CoolantResource coolant;
                                ConfigNode[] coolantResourceNodes = moduleNode.GetNodes("INPUT_RESOURCE");
                                foreach (ConfigNode node in coolantResourceNodes)
                                {
                                    coolant = new CoolantResource();
                                    coolant.name = node.GetValue("name");
                                    coolant.flowMode = (ResourceFlowMode)Enum.Parse(typeof(ResourceFlowMode), node.GetValue("flowMode"));
                                    coolant.ratio = float.Parse(node.GetValue("ratio"));
                                    coolantResources.Add(coolant);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #4
0
        protected void dumpCoolant(CoolantResource coolant, double dumpRate)
        {
            PartResourceDefinitionList definitions = PartResourceLibrary.Instance.resourceDefinitions;
            PartResourceDefinition resourceDef;
            double coolantToDump = dumpRate * TimeWarp.fixedDeltaTime;
            double coolantDumped = 0;
            double thermalEnergyCoolant = 0;

            //The the resource definition
            resourceDef = definitions[coolant.name];

            //Now calculate the resource amount dumped and the thermal energy of that slug of resource.
            coolantDumped = this.part.RequestResource(resourceDef.id, coolantToDump * coolant.ratio, coolant.flowMode);
            if (coolantDumped <= 0.001)
                return;
            thermalEnergyCoolant = this.part.temperature * this.part.resourceThermalMass * coolantDumped;

            //Practice conservation of energy...
            if (coolantDumped > 0.001)
                this.part.AddThermalFlux(-thermalEnergyCoolant);
        }