Esempio n. 1
0
        public void Save(ConfigNode node)
        {
            node.AddValue("msg_signal", msg_signal);
            node.AddValue("msg_belt", msg_belt);
            node.AddValue("cfg_ec", cfg_ec);
            node.AddValue("cfg_supply", cfg_supply);
            node.AddValue("cfg_signal", cfg_signal);
            node.AddValue("cfg_malfunction", cfg_malfunction);
            node.AddValue("cfg_storm", cfg_storm);
            node.AddValue("cfg_script", cfg_script);
            node.AddValue("cfg_highlights", cfg_highlights);
            node.AddValue("cfg_showlink", cfg_showlink);
            node.AddValue("hyspos_signal", hyspos_signal);
            node.AddValue("hysneg_signal", hysneg_signal);
            node.AddValue("storm_time", storm_time);
            node.AddValue("storm_age", storm_age);
            node.AddValue("storm_state", storm_state);
            node.AddValue("group", group);
            computer.Save(node.AddNode("computer"));
            drive.Save(node.AddNode("drive"));

            var supplies_node = node.AddNode("supplies");

            foreach (var p in supplies)
            {
                p.Value.Save(supplies_node.AddNode(DB.To_safe_key(p.Key)));
            }

            foreach (uint id in scansat_id)
            {
                node.AddValue("scansat_id", id.ToString());
            }
        }
Esempio n. 2
0
        public void Save(ConfigNode node)
        {
            // save science files
            var files_node = node.AddNode("files");

            foreach (File file in files.Values)
            {
                file.Save(files_node.AddNode(DB.To_safe_key(file.subjectData.Id)));
            }

            // save science samples
            var samples_node = node.AddNode("samples");

            foreach (Sample sample in samples.Values)
            {
                sample.Save(samples_node.AddNode(DB.To_safe_key(sample.subjectData.Id)));
            }

            node.AddValue("name", name);
            node.AddValue("is_private", is_private);
            node.AddValue("dataCapacity", dataCapacity);
            node.AddValue("sampleCapacity", sampleCapacity);

            string fileNames = string.Empty;

            foreach (string subjectId in fileSendFlags.Keys)
            {
                if (fileNames.Length > 0)
                {
                    fileNames += ",";
                }
                fileNames += subjectId;
            }
            node.AddValue("sendFileNames", fileNames);
        }
Esempio n. 3
0
        public void Save(ConfigNode node)
        {
            node.AddValue("msg_signal", msg_signal);
            node.AddValue("msg_belt", msg_belt);
            node.AddValue("cfg_ec", cfg_ec);
            node.AddValue("cfg_supply", cfg_supply);
            node.AddValue("cfg_signal", cfg_signal);
            node.AddValue("cfg_malfunction", cfg_malfunction);
            node.AddValue("cfg_storm", cfg_storm);
            node.AddValue("cfg_script", cfg_script);
            node.AddValue("cfg_highlights", cfg_highlights);
            node.AddValue("cfg_showlink", cfg_showlink);
            node.AddValue("cfg_show", cfg_show);

            node.AddValue("deviceTransmit", deviceTransmit);

            node.AddValue("solarPanelsAverageExposure", solarPanelsAverageExposure);
            node.AddValue("scienceTransmitted", scienceTransmitted);

            stormData.Save(node.AddNode("StormData"));
            computer.Save(node.AddNode("computer"));

            var supplies_node = node.AddNode("supplies");

            foreach (var p in supplies)
            {
                p.Value.Save(supplies_node.AddNode(DB.To_safe_key(p.Key)));
            }

            foreach (uint id in scansat_id)
            {
                node.AddValue("scansat_id", id.ToString());
            }

            EnvHabitatInfo.Save(node.AddNode("SunShielding"));

            ConfigNode partsNode = node.AddNode("parts");

            foreach (PartData partData in parts.Values)
            {
                // currently we only use partdata for drives, so optimize it a bit
                if (partData.Drive != null)
                {
                    ConfigNode partNode = partsNode.AddNode(partData.FlightId.ToString());
                    partData.Save(partNode);
                }
            }

            if (Vessel != null)
            {
                Lib.LogDebug("VesselData saved for vessel " + Vessel.vesselName);
            }
            else
            {
                Lib.LogDebug("VesselData saved for vessel (Vessel is null)");
            }
        }
Esempio n. 4
0
        public void Save(ConfigNode node)
        {
            node.AddValue("rescue", rescue);
            node.AddValue("disabled", disabled);
            node.AddValue("eva_dead", eva_dead);
            var rules_node = node.AddNode("rules");

            foreach (var p in rules)
            {
                p.Value.Save(rules_node.AddNode(DB.To_safe_key(p.Key)));
            }
        }
Esempio n. 5
0
        public static void Save(ConfigNode node)
        {
            // RnD subjects don't exists in sandbox
            if (!Science.GameHasRnD)
            {
                return;
            }

            // save uncredited science (transmission buffer)
            node.AddValue("uncreditedScience", uncreditedScience);

            // save science subjects persisted data
            var subjectsNode = node.AddNode("subjectData");

            foreach (SubjectData subject in persistedSubjects)
            {
                subject.Save(subjectsNode.AddNode(DB.To_safe_key(subject.Id)));
            }
        }
Esempio n. 6
0
        public void Save(ConfigNode node)
        {
            // save science files
            var files_node = node.AddNode("files");

            foreach (var p in files)
            {
                p.Value.Save(files_node.AddNode(DB.To_safe_key(p.Key)));
            }

            // save science samples
            var samples_node = node.AddNode("samples");

            foreach (var p in samples)
            {
                p.Value.Save(samples_node.AddNode(DB.To_safe_key(p.Key)));
            }

            // save preferred location
            node.AddValue("location", location);
        }
Esempio n. 7
0
        public void Save(ConfigNode node)
        {
            // save science files
            var files_node = node.AddNode("files");

            foreach (var p in files)
            {
                p.Value.Save(files_node.AddNode(DB.To_safe_key(p.Key)));
            }

            // save science samples
            var samples_node = node.AddNode("samples");

            foreach (var p in samples)
            {
                p.Value.Save(samples_node.AddNode(DB.To_safe_key(p.Key)));
            }

            node.AddValue("name", name);
            node.AddValue("dataCapacity", dataCapacity);
            node.AddValue("sampleCapacity", sampleCapacity);
        }
Esempio n. 8
0
        public static void Save(ConfigNode node)
        {
            // RnD subjects don't exists in sandbox, so we have our own subject persistence
            if (!Science.GameHasRnD)
            {
                ConfigNode sandboxSubjectsNode = node.AddNode("sandboxScienceSubjects");
                foreach (ScienceSubject subject in sandboxSubjects.Values)
                {
                    subject.Save(sandboxSubjectsNode.AddNode("subject"));
                }
            }
            else
            {
                // save API subjects (only exists if game has RnD)
                if (subjectsReceivedBuffer.Count > 0)
                {
                    ConfigNode APISubjects = node.AddNode("APISubjects");
                    for (int i = 0; i < subjectsReceivedBuffer.Count; i++)
                    {
                        ConfigNode subjectNode = APISubjects.AddNode("Subject");
                        subjectNode.AddValue("subjectId", subjectsReceivedBuffer[i].id);
                        subjectNode.AddValue("science", subjectsReceivedValueBuffer[i]);
                    }
                }
            }

            // save uncredited science (transmission buffer)
            node.AddValue("uncreditedScience", uncreditedScience);

            // save science subjects persisted data
            var subjectsNode = node.AddNode("subjectData");

            foreach (SubjectData subject in persistedSubjects)
            {
                subject.Save(subjectsNode.AddNode(DB.To_safe_key(subject.Id)));
            }
        }