Exemple #1
0
        public static BodyResourceData Load(IResourceGenerator generator, CelestialBody body, ConfigNode bodyNode)
        {
            if (bodyNode == null)
            {
                bodyNode = new ConfigNode();
            }
            var resources = generator.Load(body, bodyNode.GetNode("GeneratorData"));
            var scans     = new CellSet(KethaneData.GridLevel);

            var scanMask = bodyNode.GetValue("ScanMask");

            if (scanMask != null)
            {
                try
                {
                    scans = new CellSet(KethaneData.GridLevel, Misc.FromBase64String(scanMask));
                }
                catch (FormatException e)
                {
                    Debug.LogError(String.Format("[Kethane] Failed to parse {0} scan string, resetting ({1})", body.name, e.Message));
                }
            }

            return(new BodyResourceData(resources, scans));
        }