Пример #1
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized    = true;
            recolorHandler = new RecoloringHandler(Fields[nameof(customColorData)]);
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            string[]   names  = node.GetStringValues("textureSet");
            string[]   titles = SSTUUtils.getNames(TexturesUnlimitedLoader.getTextureSets(names), m => m.title);
            TextureSet currentTextureSetData = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);

            if (currentTextureSetData == null)
            {
                currentTextureSet     = names[0];
                currentTextureSetData = TexturesUnlimitedLoader.getTextureSet(currentTextureSet);
                initializedColors     = false;
            }
            if (!initializedColors)
            {
                initializedColors = true;
                recolorHandler.setColorData(currentTextureSetData.maskColors);
            }
            this.updateUIChooseOptionControl(nameof(currentTextureSet), names, titles, true, currentTextureSet);
            Fields[nameof(currentTextureSet)].guiActiveEditor = names.Length > 1;

            fuelType = VolumeContainerLoader.getPreset(fuelPreset);

            Transform modelBase = part.transform.FindRecursive("model");

            //Set up the engine models container
            ConfigNode[] modelNodes = node.GetNodes("MODEL");
            engineModelRoot = modelBase.FindOrCreate(engineModelRootName);
            ModelDefinitionLayoutOptions[] models = SSTUModelData.getModelDefinitions(modelNodes);
            engineModels = new ModelModule <SSTUInterstageDecoupler>(part, this, engineModelRoot, ModelOrientation.CENTRAL, nameof(currentEngineModel), nameof(currentEngineLayout), nameof(currentEngineTextureSet), nameof(customEngineColorData), null, null, null, null);
            engineModels.getSymmetryModule       = m => m.engineModels;
            engineModels.getValidOptions         = () => models;
            engineModels.getLayoutPositionScalar = () => currentBottomDiameter * 0.5f;
            //engineModels.getLayoutScaleScalar = () => currentEngineScale;
            engineModels.setupModelList(models);
            engineModels.setupModel();
            engineModels.updateSelections();
            updateEnginePositionAndScale();

            //set up the fairing container
            minHeight = engineModels.moduleHeight;
            Transform fairingContainerRoot = modelBase.FindOrCreate(baseTransformName);

            fairingBase = new FairingContainer(fairingContainerRoot.gameObject, cylinderSides, numberOfPanels, wallThickness);
            updateEditorFields();
            buildFairing();
            updateEnginePositionAndScale();
            updateFairingTextureSet(false);
            updateNodePositions(false);
            updatePartMass();
        }
Пример #2
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            double hsp  = 1;
            double dens = 1;

            PartResourceDefinition resource = PartResourceLibrary.Instance.GetDefinition(resourceName);

            hsp  = resource.specificHeatCapacity;
            dens = resource.density;

            fluxPerResourceUnit = hsp * ablationEfficiency * dens;
            baseSkinIntMult     = part.skinInternalConductionMult;
            baseCondMult        = part.heatConductivity;

            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            Transform mhsRoot = part.transform.FindRecursive("model").FindOrCreate("SSTU-MHS-Root");

            ConfigNode[] modelNodes = node.GetNodes("MODELS");
            ModelDefinitionLayoutOptions[] models = SSTUModelData.getModelDefinitions(modelNodes);
            model = new ModelModule <SSTUModularHeatShield>(part, this, mhsRoot, ModelOrientation.CENTRAL, nameof(currentShieldModel), null, nameof(currentShieldTexture), nameof(modelPersistentData), null, null, null, null);
            model.getSymmetryModule = (m) => m.model;
            model.setupModelList(models);
            model.setupModel();
            model.setScaleForDiameter(currentDiameter);
            model.setPosition(0);
            model.updateModelMeshes();
            model.updateSelections();
            model.volumeScalar = resourceScalePower;
            model.massScalar   = resourceScalePower;
            if (standAlonePart)
            {
                updateDragCube();
                updateAttachNodes(false);
            }
            SSTUModInterop.updateResourceVolume(part);
            ConfigNode[] typeNodes = node.GetNodes("SHIELDTYPE");
            shieldTypeData        = HeatShieldTypeData.load(typeNodes);
            currentShieldTypeData = Array.Find(shieldTypeData, m => m.baseType.name == currentShieldType);
            updateModuleStats();
            updatePartCost();
            SSTUModInterop.onPartGeometryUpdate(part, false);
            SSTUModInterop.updateResourceVolume(part);
            SSTUStockInterop.fireEditorUpdate();//update for mass/cost/etc.
        }
Пример #3
0
        private void init()
        {
            if (initialized)
            {
                return;
            }
            initialized         = true;
            standoffRotatedRoot = part.transform.FindRecursive("SSTUModularRCSStructureRoot");
            if (standoffRotatedRoot == null)
            {
                standoffRotatedRoot = new GameObject("SSTUModularRCSStructureRoot").transform;
                standoffRotatedRoot.NestToParent(part.transform.FindRecursive("model"));
                standoffRotatedRoot.Rotate(90, -90, 0);
            }
            modelRotatedRoot = part.transform.FindRecursive("SSTUModularRCSBlockRoot");
            if (modelRotatedRoot == null)
            {
                modelRotatedRoot = new GameObject("SSTUModularRCSBlockRoot").transform;
                modelRotatedRoot.NestToParent(part.transform.FindRecursive("model"));
                modelRotatedRoot.Rotate(0, 0, 0);
            }
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ModelDefinitionLayoutOptions[] blocks  = SSTUModelData.getModelDefinitions(node.GetNodes("MODEL"));
            ModelDefinitionLayoutOptions[] structs = SSTUModelData.getModelDefinitions(node.GetNodes("STRUCTURE"));

            modelTransform      = modelRotatedRoot.FindOrCreate("ModularRCSModel");
            rcsBlockModule      = new ModelModule <SSTUModularRCS>(part, this, modelTransform, ModelOrientation.CENTRAL, nameof(currentModel), nameof(currentLayout), nameof(currentTexture), nameof(modelPersistentData), null, null, null, null);
            rcsBlockModule.name = "RCSBlock";
            rcsBlockModule.getSymmetryModule = m => m.rcsBlockModule;
            rcsBlockModule.setupModelList(blocks);
            rcsBlockModule.getValidOptions = () => blocks;
            rcsBlockModule.setupModel();
            rcsBlockModule.updateSelections();

            standoffTransform   = standoffRotatedRoot.FindOrCreate("ModularRCSStandoff");
            standoffModule      = new ModelModule <SSTUModularRCS>(part, this, standoffTransform, ModelOrientation.TOP, nameof(currentStructure), nameof(currentLayout), nameof(currentStructureTexture), nameof(structurePersistentData), null, null, null, null);
            standoffModule.name = "Standoff";
            standoffModule.getSymmetryModule = m => m.standoffModule;
            standoffModule.setupModelList(structs);
            standoffModule.getValidOptions = () => structs;
            standoffModule.setupModel();
            standoffModule.updateSelections();

            updateModelScale();
            updateMassAndCost();
            rcsBlockModule.renameRCSThrustTransforms(rcsThrustTransformName);

            updateAttachNodes(false);
        }
Пример #4
0
        private void initialize()
        {
            if (initialized)
            {
                return;
            }
            initialized = true;
            ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData);

            ModelDefinitionLayoutOptions[] defs = SSTUModelData.getModelDefinitions(node.GetNodes("MODEL"));
            Transform root = part.transform.FindRecursive("model").FindOrCreate(rootTransformName);

            models      = new ModelModule <SSTUModelSwitch>(part, this, root, ModelOrientation.TOP, nameof(currentModel), null, nameof(currentTexture), nameof(modelPersistentData), nameof(animationPersistentData), nameof(animationMaxDeploy), nameof(enableAnimationEvent), nameof(disableAnimationEvent));
            models.name = "ModelSwitch";
            models.getSymmetryModule = m => m.models;
            models.getValidOptions   = () => defs;
            models.setupModelList(defs);
            models.setupModel();
            models.setScale(currentScale);
            models.updateModelMeshes();
            models.updateSelections();
            updateMassAndCost();
            updateAttachNodes(false);
        }