private void initialize()
 {
     if (rendersToRemove != null && rendersToRemove.Length > 0)
     {
         SSTUUtils.removeTransforms(part, SSTUUtils.parseCSV(rendersToRemove));
     }
     loadFairingData(SSTUStockInterop.getPartModuleConfig(part, this));
     if (externalUpdateData != null)
     {
         updateFromExternalData(externalUpdateData);
     }
     updateEditorFields(false); //update cached editor gui field values for diameter, sections, etc.
     buildFairing();            //construct fairing from cached/persistent/default data
     needsStatusUpdate = true;
     if (textureSets != null)
     {
         if (textureSets.Length <= 1)//only a single, (or no) texture set selected/avaialable
         {
             Events["nextTextureEvent"].active = false;
         }
         if (textureSets.Length > 0 && String.IsNullOrEmpty(currentTextureSet))
         {
             TextureSet s = textureSets[0];
             currentTextureSet = textureSets[0].setName;
         }
     }
 }
Exemple #2
0
 private void initialize()
 {
     //MonoBehaviour.print("NodeFairingInit: "+fairingCreated+ " :: " +fairingForceDisabled+ " :: "+fairingJettisoned + " :: " +fairingEnabled);
     if (rendersToRemove != null && rendersToRemove.Length > 0)
     {
         SSTUUtils.removeTransforms(part, SSTUUtils.parseCSV(rendersToRemove));
     }
     loadFairingData(SSTUConfigNodeUtils.parseConfigNode(configNodeData));
     if (externalUpdateData != null)
     {
         updateFromExternalData(externalUpdateData);
     }
     if (fairingCreated || (fairingEnabled && !fairingJettisoned && !fairingForceDisabled && string.IsNullOrEmpty(nodeName)))//previously existed, recreate it, or should exist by default values in the config
     {
         buildFairing();
         if (!string.IsNullOrEmpty(nodeName))
         {
             AttachNode n = part.FindAttachNode(nodeName);
             if (n != null && n.attachedPart != null)
             {
                 prevAttachedPart = n.attachedPart;
                 //MonoBehaviour.print("Setting initial attached part to: " + prevAttachedPart);
             }
         }
     }
     else if (!fairingJettisoned && !fairingForceDisabled && !string.IsNullOrEmpty(nodeName))//else could potentially be activated by a node...check for activation
     {
         needsStatusUpdate = true;
     }
     updateTextureSet(false);
     needsGuiUpdate = true;
     //MonoBehaviour.print("NodeFairingInit End: " + fairingCreated + " :: " + fairingForceDisabled + " :: " + fairingJettisoned + " :: " + fairingEnabled);
 }
Exemple #3
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;
            }
        }