public static ResourceData Load(ResourceDefinition resource, ConfigNode resourceNode) { var bodyResources = new Dictionary <CelestialBody, BodyResourceData>(); var generatorNode = resourceNode.GetNode("Generator") ?? resource.Generator; var generator = createGenerator(generatorNode.CreateCopy()); if (generator == null) { Debug.LogWarning("[Kethane] Defaulting to empty generator for " + resource.Resource); generator = new EmptyResourceGenerator(); } var bodyNodes = resourceNode.GetNodes("Body"); foreach (var body in FlightGlobals.Bodies) { var bodyNode = bodyNodes.SingleOrDefault(n => n.GetValue("Name") == body.name); bodyResources[body] = BodyResourceData.Load(generator, body, bodyNode); } return(new ResourceData(generator, generatorNode, bodyResources)); }
public void ResetBodyData(CelestialBody body) { bodies[body] = BodyResourceData.Load(generator, body, null); }