public static SSTUEngineLayout[] getAllLayouts()
 {
     ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes("SSTU_ENGINELAYOUT");
     int len = nodes.Length;
     SSTUEngineLayout[] layouts = new SSTUEngineLayout[len];
     for (int i = 0; i < len; i++)
     {
         layouts[i] = new SSTUEngineLayout(nodes[i]);
     }
     return layouts;
 }
        public static SSTUEngineLayout[] getAllLayouts()
        {
            ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes("SSTU_ENGINELAYOUT");
            int          len   = nodes.Length;

            SSTUEngineLayout[] layouts = new SSTUEngineLayout[len];
            for (int i = 0; i < len; i++)
            {
                layouts[i] = new SSTUEngineLayout(nodes[i]);
            }
            return(layouts);
        }
        public static Dictionary <String, SSTUEngineLayout> getAllLayoutsDict()
        {
            ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes("SSTU_ENGINELAYOUT");
            int          len   = nodes.Length;
            Dictionary <String, SSTUEngineLayout> layouts = new Dictionary <String, SSTUEngineLayout>();
            SSTUEngineLayout layout;

            for (int i = 0; i < len; i++)
            {
                layout = new SSTUEngineLayout(nodes[i]);
                if (!layouts.ContainsKey(layout.name))
                {
                    layouts.Add(layout.name, layout);
                }
            }
            return(layouts);
        }
        public EngineClusterLayoutData(SSTUEngineLayout layoutData, ConfigNode node, float engineScale, float moduleEngineSpacing, float moduleMountSize, float increment, bool upperMounts, bool lowerMounts)
        {
            this.engineScale = engineScale;
            this.layoutData = layoutData;
            layoutName = layoutData.name;

            defaultMount = lowerMounts? layoutData.defaultLowerStageMount : layoutData.defaultUpperStageMount;
            engineSpacing = moduleEngineSpacing;

            Dictionary<String, ConfigNode> localMountNodes = new Dictionary<String, ConfigNode>();
            Dictionary<String, SSTUEngineLayoutMountOption> globalMountOptions = new Dictionary<String, SSTUEngineLayoutMountOption>();
            List<ConfigNode> customMounts = new List<ConfigNode>();

            String name;
            ConfigNode mountNode;

            SSTUEngineLayoutMountOption mountOption;
            int len = layoutData.mountOptions.Length;
            for (int i = 0; i < len; i++)
            {
                mountOption = layoutData.mountOptions[i];
                if ((mountOption.upperStage && upperMounts) || (mountOption.lowerStage && lowerMounts))
                {
                    globalMountOptions.Add(mountOption.mountName, mountOption);
                }
            }

            if (node != null)
            {
                //override data from the config node
                defaultMount = node.GetStringValue("defaultMount", defaultMount);
                engineSpacing = node.GetFloatValue("engineSpacing", engineSpacing);
                engineRotationOverride = node.GetFloatValuesCSV("rotateEngines", engineRotationOverride);
                ConfigNode[] mountNodes = node.GetNodes("MOUNT");
                len = mountNodes.Length;
                for (int i = 0; i < len; i++)
                {
                    mountNode = mountNodes[i];
                    name = mountNode.GetStringValue("name");
                    if (mountNode.GetBoolValue("remove", false))
                    {
                        globalMountOptions.Remove(name);
                    }
                    else
                    {
                        if (!globalMountOptions.ContainsKey(name))
                        {
                            customMounts.Add(mountNode);
                        }
                        localMountNodes.Add(name, mountNode);
                    }
                }
            }

            engineSpacing = engineSpacing * engineScale;//pre-scale the engine spacing by the engine scale value; needed for engine positioning and mount-size calculation
            moduleMountSize = moduleMountSize * engineScale;//pre-scale the mount size by the engine scale value; needed for mount-size calculation
            List<EngineClusterLayoutMountData> mountDataTemp = new List<EngineClusterLayoutMountData>();
            foreach(String key in globalMountOptions.Keys)
            {
                if (localMountNodes.ContainsKey(key))//was specified in the config and was not a simple removal; merge values into global node...
                {
                    mountNode = mergeNodes(getAutoSizeNode(globalMountOptions[key], engineSpacing, moduleMountSize, increment), localMountNodes[key]);
                }
                else
                {
                    mountNode = getAutoSizeNode(globalMountOptions[key], engineSpacing, moduleMountSize, increment);
                }
                mountDataTemp.Add(new EngineClusterLayoutMountData(mountNode));
            }
            foreach (ConfigNode cm in customMounts)
            {
                mountDataTemp.Add(new EngineClusterLayoutMountData(cm));
            }
            mountData = mountDataTemp.ToArray();
        }
 /// <summary>
 /// Loads the engine layout definitions from config file in GameData/SSTU/Data/Engines/engineLayouts.cfg.  Rather, it will load any config node with a name of "SSTU_ENGINELAYOUT".
 /// </summary>
 private void loadMap()
 {
     if (mapLoaded) { return; }
     layoutMap.Clear();
     ConfigNode[] layoutNodes = GameDatabase.Instance.GetConfigNodes("SSTU_ENGINELAYOUT");
     SSTUEngineLayout layout;
     foreach (ConfigNode layoutNode in layoutNodes)
     {
         layout = new SSTUEngineLayout(layoutNode);
         layoutMap.Add(layout.name, layout);
     }
 }
 public static Dictionary<String, SSTUEngineLayout> getAllLayoutsDict()
 {
     ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes("SSTU_ENGINELAYOUT");
     int len = nodes.Length;
     Dictionary<String, SSTUEngineLayout> layouts = new Dictionary<String, SSTUEngineLayout>();
     SSTUEngineLayout layout;
     for (int i = 0; i < len; i++)
     {
         layout = new SSTUEngineLayout(nodes[i]);
         if (!layouts.ContainsKey(layout.name))
         {
             layouts.Add(layout.name, layout);
         }
     }
     return layouts;
 }