public override void OnLoad(ConfigNode node) { instance = this; recoveredDMScience.Clear(); ConfigNode results_node = node.GetNode("Asteroid_Science"); if (results_node != null) { foreach (ConfigNode scienceResults_node in results_node.GetNodes("DM_Science")) { if (scienceResults_node != null) { float bsv = 1; float scv = 1; float sci = 0; float cap = 1; if (!scienceResults_node.HasValue("title")) continue; string title = scienceResults_node.GetValue("title"); if (!float.TryParse(scienceResults_node.GetValue("bsv"), out bsv)) bsv = 1; if (!float.TryParse(scienceResults_node.GetValue("scv"), out scv)) scv = 1; if (!float.TryParse(scienceResults_node.GetValue("sci"), out sci)) sci = 0; if (!float.TryParse(scienceResults_node.GetValue("cap"), out cap)) cap = 1; RecordNewScience(title, bsv, scv, sci, cap); } } } }
public override void OnLoad(ConfigNode node) { instance = this; recoveredDMScience.Clear(); ConfigNode results_node = node.GetNode("Asteroid_Science"); if (results_node != null) { foreach (ConfigNode scienceResults_node in results_node.GetNodes("DM_Science")) { if (scienceResults_node != null) { float bsv = 1; float scv = 1; float sci = 0; float cap = 1; if (!scienceResults_node.HasValue("title")) { continue; } string title = scienceResults_node.GetValue("title"); if (!float.TryParse(scienceResults_node.GetValue("bsv"), out bsv)) { bsv = 1; } if (!float.TryParse(scienceResults_node.GetValue("scv"), out scv)) { scv = 1; } if (!float.TryParse(scienceResults_node.GetValue("sci"), out sci)) { sci = 0; } if (!float.TryParse(scienceResults_node.GetValue("cap"), out cap)) { cap = 1; } RecordNewScience(title, bsv, scv, sci, cap); } } } }
public override void OnLoad(ConfigNode node) { instance = this; recoveredDMScience.Clear(); ConfigNode results_node = node.GetNode("Asteroid_Science"); if (results_node != null) { foreach (ConfigNode scienceResults_node in results_node.GetNodes("DM_Science")) { if (scienceResults_node == null) { continue; } string title = scienceResults_node.parse("title", ""); if (string.IsNullOrEmpty(title)) { continue; } float bsv = scienceResults_node.parse("bsv", (float)1); float scv = scienceResults_node.parse("scv", (float)1); float sci = scienceResults_node.parse("sci", (float)0); float cap = scienceResults_node.parse("cap", (float)1); RecordNewScience(title, bsv, scv, sci, cap); } } DMAnomalyList.clearAnomalies(); ConfigNode anomaly_node = node.GetNode("Anomaly_Records"); if (anomaly_node != null) { foreach (ConfigNode anomalyList in anomaly_node.GetNodes("DM_Anomaly_List")) { if (anomalyList == null) { continue; } CelestialBody body = anomalyList.parse("Body", (CelestialBody)null); if (body == null) { continue; } DMAnomalyStorage anomStorage = new DMAnomalyStorage(body); foreach (ConfigNode anomaly in anomalyList.GetNodes("DM_Anomaly")) { string name = anomaly.parse("Name", ""); if (string.IsNullOrEmpty(name)) { continue; } double lat = anomaly.parse("Lat", (double)0); double lon = anomaly.parse("Lon", (double)0); double alt = anomaly.parse("Alt", (double)0); anomStorage.addAnomaly(new DMAnomalyObject(name, body, lat, lon, alt)); } if (anomStorage.AnomalyCount > 0) { DMAnomalyList.addAnomalyStorage(body.bodyName, anomStorage); } } } }