public HeatShieldTypeData(ConfigNode node)
        {
            string typeName = node.GetValue("name");

            baseType       = SSTUDatabase.getHeatShieldType(typeName);
            resourceMult   = node.GetFloatValue("resourceMult", baseType.resourceMult);
            ablationStart  = node.GetFloatValue("ablationStart", baseType.ablationStart);
            ablationEnd    = node.GetFloatValue("ablationEnd", baseType.ablationEnd);
            ablationMult   = node.GetFloatValue("ablationMult", baseType.ablationMult);
            massMult       = node.GetFloatValue("massMult", baseType.massMult);
            heatCurve      = node.GetFloatCurve("heatCurve", baseType.heatCurve);
            efficiencyMult = node.GetFloatValue("efficiencyMult", 1.0f);
        }
 private static void loadHeatShieldTypes()
 {
     heatShieldTypesMap.Clear();
     heatShieldTypesList.Clear();
     HeatShieldType shield;
     ConfigNode[] heatShieldNodes = GameDatabase.Instance.GetConfigNodes("SSTU_HEATSHIELD");
     int len = heatShieldNodes.Length;
     for (int i = 0; i < len; i++)
     {
         shield = new HeatShieldType(heatShieldNodes[i]);
         heatShieldTypesMap.Add(shield.name, shield);
         heatShieldTypesList.Add(shield);
     }
 }
Exemple #3
0
        private static void loadHeatShieldTypes()
        {
            heatShieldTypesMap.Clear();
            heatShieldTypesList.Clear();
            HeatShieldType shield;

            ConfigNode[] heatShieldNodes = GameDatabase.Instance.GetConfigNodes("SSTU_HEATSHIELD");
            int          len             = heatShieldNodes.Length;

            for (int i = 0; i < len; i++)
            {
                shield = new HeatShieldType(heatShieldNodes[i]);
                heatShieldTypesMap.Add(shield.name, shield);
                heatShieldTypesList.Add(shield);
            }
        }
Exemple #4
0
 private void setShieldTypeFromEditor(String newType, bool updateSymmetry)
 {
     currentShieldType     = newType;
     currentShieldTypeData = SSTUDatabase.getHeatShieldType(newType);
     updateModuleStats();
     updatePartResources();
     updatePartCost();
     updateEditorFields();
     if (updateSymmetry)
     {
         SSTUModularHeatShield mhs;
         foreach (Part p in part.symmetryCounterparts)
         {
             mhs = p.GetComponent <SSTUModularHeatShield>();
             mhs.setShieldTypeFromEditor(newType, false);
         }
         SSTUStockInterop.fireEditorUpdate();
     }
 }
Exemple #5
0
        private void initialize()
        {
            if (heatCurve == null)
            {
                heatCurve = new FloatCurve();
                heatCurve.Add(0, 0.00002f);  //very minimal initial ablation factor
                heatCurve.Add(50, 0.00005f); //ramp it up fairly quickly though
                heatCurve.Add(150, 0.00015f);
                heatCurve.Add(500, 0.00050f);
                heatCurve.Add(750, 0.00075f);
                heatCurve.Add(1000, 0.00100f);
                heatCurve.Add(2000, 0.00400f);
                heatCurve.Add(3000, 0.00800f);  //generally, things will explode before this point
                heatCurve.Add(10000, 0.05000f); //but just in case, continue the curve up to insane levels
            }
            double hsp  = 1;
            double dens = 1;

            if (heatSoak)
            {
                PartResourceDefinition resource = PartResourceLibrary.Instance.GetDefinition(resourceName);
                hsp  = resource.specificHeatCapacity;
                dens = resource.density;
            }
            else
            {
                resource = part.Resources[resourceName];
                if (resource != null)
                {
                    hsp  = resource.info.specificHeatCapacity;
                    dens = resource.info.density;
                }
                else
                {
                    hsp  = PhysicsGlobals.StandardSpecificHeatCapacity;
                    dens = 0.005f;
                }
            }
            useToFluxMultiplier = hsp * ablationEfficiency * dens * ablationMult;
            baseSkinIntMult     = part.skinInternalConductionMult;

            //stand-alone modular heat-shield setup
            if (standAlonePart)
            {
                if (string.IsNullOrEmpty(modelName))
                {
                    MonoBehaviour.print("SEVERE ERROR: SSTUModularHeatShield could has no model specified for part: " + part.name);
                }

                if (!String.IsNullOrEmpty(transformsToRemove))
                {
                    SSTUUtils.removeTransforms(part, SSTUUtils.parseCSV(transformsToRemove));
                }

                shieldTypeNames = SSTUDatabase.getHeatShieldNames();

                ConfigNode modelNode = new ConfigNode("MODEL");
                modelNode.AddValue("name", modelName);
                mainModelData = new SingleModelData(modelNode);
                mainModelData.setupModel(part.transform.FindRecursive("model"), ModelOrientation.CENTRAL, true);
                setModelDiameter(currentDiameter);
                updateAttachNodes(false);
                updateDragCube();
                updateEditorFields();
            }

            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ConfigNode[] typeNodes = node.GetNodes("SHIELDTYPE");
            int          len       = typeNodes.Length;

            shieldTypeNames = new string[len];
            for (int i = 0; i < len; i++)
            {
                shieldTypeNames[i] = typeNodes[i].GetStringValue("name");
            }
            if (shieldTypeNames.Length == 0)
            {
                shieldTypeNames = new string[] { "Medium" };
            }
            currentShieldTypeData = SSTUDatabase.getHeatShieldType(currentShieldType);
            heatCurve             = currentShieldTypeData.heatCurve;

            updatePartCost();
            if (!initializedResources && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
            {
                updatePartResources();
                initializedResources = true;
            }
        }
 private void setShieldTypeFromEditor(String newType, bool updateSymmetry)
 {
     currentShieldType = newType;
     currentShieldTypeData = SSTUDatabase.getHeatShieldType(newType);
     updateModuleStats();
     updatePartResources();
     updatePartCost();
     updateEditorFields();
     if (updateSymmetry)
     {
         SSTUModularHeatShield mhs;
         foreach (Part p in part.symmetryCounterparts)
         {
             mhs = p.GetComponent<SSTUModularHeatShield>();
             mhs.setShieldTypeFromEditor(newType, false);
         }
         SSTUStockInterop.fireEditorUpdate();
     }
 }
        private void initialize()
        {
            if (heatCurve == null)
            {
                heatCurve = new FloatCurve();
                heatCurve.Add(0, 0.00002f);//very minimal initial ablation factor
                heatCurve.Add(50, 0.00005f);//ramp it up fairly quickly though
                heatCurve.Add(150, 0.00015f);
                heatCurve.Add(500, 0.00050f);
                heatCurve.Add(750, 0.00075f);
                heatCurve.Add(1000, 0.00100f);
                heatCurve.Add(2000, 0.00400f);
                heatCurve.Add(3000, 0.00800f);//generally, things will explode before this point
                heatCurve.Add(10000, 0.05000f);//but just in case, continue the curve up to insane levels
            }
            double hsp = 1;
            double dens = 1;
            if (heatSoak)
            {
                PartResourceDefinition resource = PartResourceLibrary.Instance.GetDefinition(resourceName);
                hsp = resource.specificHeatCapacity;
                dens = resource.density;
            }
            else
            {
                resource = part.Resources[resourceName];
                if (resource != null)
                {
                    hsp = resource.info.specificHeatCapacity;
                    dens = resource.info.density;
                }
                else
                {
                    hsp = PhysicsGlobals.StandardSpecificHeatCapacity;
                    dens = 0.005f;
                }
            }
            useToFluxMultiplier = hsp * ablationEfficiency * dens * ablationMult;
            baseSkinIntMult = part.skinInternalConductionMult;

            //stand-alone modular heat-shield setup
            if (standAlonePart)
            {
                if (string.IsNullOrEmpty(modelName))
                {
                    MonoBehaviour.print("SEVERE ERROR: SSTUModularHeatShield could has no model specified for part: " + part.name);
                }

                if (!String.IsNullOrEmpty(transformsToRemove))
                {
                    SSTUUtils.removeTransforms(part, SSTUUtils.parseCSV(transformsToRemove));
                }

                shieldTypeNames = SSTUDatabase.getHeatShieldNames();

                ConfigNode modelNode = new ConfigNode("MODEL");
                modelNode.AddValue("name", modelName);
                mainModelData = new SingleModelData(modelNode);
                mainModelData.setupModel(part.transform.FindRecursive("model"), ModelOrientation.CENTRAL, true);
                setModelDiameter(currentDiameter);
                updateAttachNodes(false);
                updateDragCube();
                updateEditorFields();
            }

            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);
            ConfigNode[] typeNodes = node.GetNodes("SHIELDTYPE");
            int len = typeNodes.Length;
            shieldTypeNames = new string[len];
            for (int i = 0; i < len; i++)
            {
                shieldTypeNames[i] = typeNodes[i].GetStringValue("name");
            }
            if (shieldTypeNames.Length == 0) { shieldTypeNames = new string[] { "Medium" }; }
            currentShieldTypeData = SSTUDatabase.getHeatShieldType(currentShieldType);
            heatCurve = currentShieldTypeData.heatCurve;

            updatePartCost();
            if (!initializedResources && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
            {
                updatePartResources();
                initializedResources = true;
            }
        }