Esempio n. 1
0
        public SSTUEngineLayout(ConfigNode node)
        {
            name                   = node.GetStringValue("name");
            mountSizeMult          = node.GetFloatValue("mountSizeMult", mountSizeMult);
            defaultUpperStageMount = node.GetStringValue("defaultUpperStageMount", defaultUpperStageMount);
            defaultLowerStageMount = node.GetStringValue("defaultLowerStageMount", defaultLowerStageMount);

            ConfigNode[] posNodes = node.GetNodes("POSITION");
            int          len      = posNodes.Length;

            for (int i = 0; i < len; i++)
            {
                positions.Add(new SSTUEnginePosition(posNodes[i]));
            }

            ConfigNode[] mountNodes = node.GetNodes("MOUNT");
            len          = mountNodes.Length;
            mountOptions = new SSTUEngineLayoutMountOption[len];
            for (int i = 0; i < len; i++)
            {
                mountOptions[i] = new SSTUEngineLayoutMountOption(mountNodes[i]);
            }
        }
 /// <summary>
 /// Calculate engine mount size, minSize, and maxSize, and return a configNode defining those values for the input mount.
 /// </summary>
 /// <param name="option">The mount option as defined in the engine layout</param>
 /// <param name="engineSpacing">Pre-scaled engine spacing value</param>
 /// <param name="engineMountSize">Pre-scaled engine mount area value</param>
 /// <param name="increment">mount diameter increment as specified in the engine module</param>
 /// <returns></returns>
 private ConfigNode getAutoSizeNode(SSTUEngineLayoutMountOption option, float engineSpacing, float engineMountSize, float increment)
 {
     ModelDefinition mdf = SSTUModelData.getModelDefinition(option.mountName);
     float modelMountArea = mdf.configNode.GetFloatValue("mountingDiameter");//TODO clean up the need to cache the config node for a simple use
     float minSize = 2.5f, maxSize = 10f, size = 2.5f;
     calcAutoMountSize(engineSpacing, engineMountSize, mdf.diameter, modelMountArea, layoutData.mountSizeMult, increment, out size, out minSize, out maxSize);
     ConfigNode node = new ConfigNode("MOUNT");
     node.AddValue("name", option.mountName);
     node.AddValue("size", size);
     node.AddValue("minSize", minSize);
     node.AddValue("maxSize", maxSize);
     return node;
 }