Exemplo n.º 1
0
        public void scanPlanet(CelestialBody b)
        {
            DMAnomalyStorage anom = DMAnomalyList.getAnomalyStorage(b.bodyName);

            if (anom == null)
            {
                anom = new DMAnomalyStorage(b, false);
            }

            if (anom.Scanned)
            {
                return;
            }

            if (anom.scanBody())
            {
                DMAnomalyList.addAnomalyStorage(b.bodyName, anom);
            }
        }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }