public override void OnStart(StartState state) { base.OnStart(state); mpf = part.GetComponent <ModuleProceduralFairing>(); ConfigNode node = SSTUStockInterop.getPartModuleConfig(part, this); textureSets = TextureSet.loadTextureSets(node.GetNodes("TEXTURESET")); int len = textureSets.Length; string[] textureSetNames = new string[len]; for (int i = 0; i < len; i++) { textureSetNames[i] = textureSets[i].setName; } this.updateUIChooseOptionControl("currentTextureSet", textureSetNames, textureSetNames, true, currentTextureSet); techLimitMaxDiameter = SSTUStockInterop.getTechLimit(techLimitSet); if (currentDiameter > techLimitMaxDiameter) { currentDiameter = techLimitMaxDiameter; } updateModelScale(); updateTexture(currentTextureSet); updateNodePositions(false); float max = techLimitMaxDiameter < maxDiameter ? techLimitMaxDiameter : maxDiameter; this.updateUIFloatEditControl("currentDiameter", minDiameter, max, diameterIncrement * 2f, diameterIncrement, diameterIncrement * 0.05f, true, currentDiameter); Fields["currentDiameter"].uiControlEditor.onFieldChanged = onDiameterUpdated; Fields["currentTextureSet"].uiControlEditor.onFieldChanged = onTextureUpdated; Fields["currentTextureSet"].guiActiveEditor = textureSets.Length > 1; updateEditorFields(); }
private void loadConfigData() { ConfigNode node = SSTUStockInterop.getPartModuleConfig(part, this); ConfigNode[] textureNodes = node.GetNodes("TEXTURESET"); int len = textureNodes.Length; textureSetData = new TextureSet[len]; for (int i = 0; i < len; i++) { textureSetData[i] = new TextureSet(textureNodes[i]); } currentTextureSetData = Array.Find(textureSetData, m => m.setName == currentTextureSet); if (currentTextureSetData == null) { currentTextureSetData = textureSetData[0]; currentTextureSet = currentTextureSetData.setName; } string[] textureSetNames = new string[len]; for (int i = 0; i < len; i++) { textureSetNames[i] = textureSetData[i].setName; } this.updateUIChooseOptionControl("currentTextureSet", textureSetNames, textureSetNames, true, currentTextureSet); techLimitMaxDiameter = SSTUStockInterop.getTechLimit(techLimitSet); if (diameter > techLimitMaxDiameter) { diameter = techLimitMaxDiameter; } }
private void initialize() { techLimitMaxDiameter = SSTUStockInterop.getTechLimit(techLimitSet); if (currentDiameter > techLimitMaxDiameter) { currentDiameter = techLimitMaxDiameter; } if (currentDiameter > maxDiameter) { currentDiameter = maxDiameter; } if (currentDiameter < minDiameter) { currentDiameter = minDiameter; } updateEditorFields(); updateModelScale(); updateDragCubes(); updatePartCost(); updatePartMass(); }
protected virtual void initialize() { if (initialized) { return; } initialized = true; loadConfigData(); techLimitMaxDiameter = SSTUStockInterop.getTechLimit(techLimitSet); if (currentTankDiameter > techLimitMaxDiameter) { currentTankDiameter = techLimitMaxDiameter; } updateModuleStats(); restoreModels(); updateModels(); updateTextureSet(false); restoreEditorFields(); updateTankStats(); updateAttachNodes(false); }
private void initialize() { if (initialized) { return; } initialized = true; ConfigNode node = SSTUStockInterop.getPartModuleConfig(part, this); ConfigNode[] textureNodes = node.GetNodes("TEXTURESET"); textureSetData = TextureSet.loadTextureSets(textureNodes); currentTextureSetData = Array.Find(textureSetData, m => m.setName == currentTextureSet); if (currentTextureSetData == null) { currentTextureSetData = textureSetData[0]; currentTextureSet = currentTextureSetData.setName; } int len = textureSetData.Length; string[] textureSetNames = new string[len]; for (int i = 0; i < len; i++) { textureSetNames[i] = textureSetData[i].setName; } this.updateUIChooseOptionControl("currentTextureSet", textureSetNames, textureSetNames, true, currentTextureSet); TextureData data = currentTextureSetData.textureDatas[0]; fairingMaterial = SSTUUtils.loadMaterial(data.diffuseTextureName, null, "KSP/Specular"); loadMaterial(); techLimitMaxDiameter = SSTUStockInterop.getTechLimit(techLimitSet); if (topDiameter > techLimitMaxDiameter) { topDiameter = techLimitMaxDiameter; } if (bottomDiameter > techLimitMaxDiameter) { bottomDiameter = techLimitMaxDiameter; } Transform tr = part.transform.FindRecursive("model").FindOrCreate("PetalAdapterRoot"); fairingBase = new InterstageFairingContainer(tr.gameObject, cylinderSides, numberOfPanels, wallThickness); UVMap uvs = UVMap.GetUVMapGlobal(uvMap); fairingBase.outsideUV = uvs.getArea("outside"); fairingBase.insideUV = uvs.getArea("inside"); fairingBase.edgesUV = uvs.getArea("edges"); rebuildFairing(false);//will create fairing using default / previously saved fairing configuration restoreEditorFields(); setPanelRotations(currentRotation); if (panelsJettisoned) { fairingBase.destroyExistingPanels(); } updateGuiState(); }
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)); } techLimitMaxDiameter = SSTUStockInterop.getTechLimit(techLimitSet); if (currentDiameter > techLimitMaxDiameter) { currentDiameter = techLimitMaxDiameter; } shieldTypeNames = SSTUDatabase.getHeatShieldNames(); ConfigNode modelNode = new ConfigNode("MODEL"); modelNode.AddValue("name", modelName); mainModelData = new SingleModelData(modelNode); mainModelData.setupModel(part, part.transform.FindRecursive("model"), ModelOrientation.CENTRAL, true); setModelDiameter(currentDiameter); updateAttachNodes(false); updateDragCube(); updateEditorFields(); } ConfigNode node = SSTUStockInterop.getPartModuleConfig(this); 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; } }