Example #1
0
        protected override void OnLoadFromConfig(ConfigNode node)
        {
            base.OnLoadFromConfig(node);

            bodies = ConfigNodeUtil.ParseValue <List <CelestialBody> >(node, "bodies");
            weight = ConfigNodeUtil.ParseValue <int>(node, "weight");
        }
Example #2
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                count = ConfigNodeUtil.ParseValue <int>(node, "count");
                index = ConfigNodeUtil.ParseValue <int>(node, "index");

                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                {
                    // Legacy support for Contract Configurator 1.8.3
                    if (kerbalNode.HasValue("kerbal"))
                    {
                        kerbalNode.AddValue("name", kerbalNode.GetValue("kerbal"));
                    }

                    kerbals.Add(Kerbal.Load(kerbalNode));
                    recovered[kerbals.Last().name] = ConfigNodeUtil.ParseValue <bool>(kerbalNode, "recovered");
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <string> .OnDelegateContainerLoad(node);
            }
        }
Example #3
0
 protected override void OnLoadFromConfig(ConfigNode node)
 {
     currency          = ConfigNodeUtil.ParseValue <Currency>(node, "currency");
     effectDescription = ConfigNodeUtil.ParseValue <string>(node, "effectDescription");
     affectReasons     = ConfigNodeUtil.ParseValue <List <TransactionReasons> >(node, "affectReason");
     multipliers       = ConfigNodeUtil.ParseValue <List <float> >(node, "multiplier");
 }
        protected override void OnLoad(ConfigNode configNode)
        {
            parts = ConfigNodeUtil.ParseValue <List <AvailablePart> >(configNode, "part");

            if (configNode.HasValue("remove"))
            {
                bool remove = ConfigNodeUtil.ParseValue <bool>(configNode, "remove");
                lockCriteria = remove ? ExperimentalPart.LockCriteria.CONTRACT_ACCEPTANCE : ExperimentalPart.LockCriteria.DO_NOT_LOCK;
            }
            else
            {
                lockCriteria  = ConfigNodeUtil.ParseValue <LockCriteria>(configNode, "lockCriteria");
                lockParameter = ConfigNodeUtil.ParseValue <string>(configNode, "lockParameter", "");
            }

            if (configNode.HasValue("add"))
            {
                bool add = ConfigNodeUtil.ParseValue <bool>(configNode, "add");
                unlockCriteria = add ? ExperimentalPart.UnlockCriteria.CONTRACT_ACCEPTANCE : ExperimentalPart.UnlockCriteria.DO_NOT_UNLOCK;
            }
            else
            {
                unlockCriteria  = ConfigNodeUtil.ParseValue <UnlockCriteria>(configNode, "unlockCriteria");
                unlockParameter = ConfigNodeUtil.ParseValue <string>(configNode, "unlockParameter", "");
            }
        }
Example #5
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                targetBodies       = ConfigNodeUtil.ParseValue <List <CelestialBody> >(node, "targetBody", null);
                biome              = ConfigNodeUtil.ParseValue <string>(node, "biome", "");
                situation          = ConfigNodeUtil.ParseValue <List <Vessel.Situations> >(node, "situation", new List <Vessel.Situations>());
                minAltitude        = ConfigNodeUtil.ParseValue <float>(node, "minAltitude", float.MinValue);
                maxAltitude        = ConfigNodeUtil.ParseValue <float>(node, "maxAltitude", float.MaxValue);
                minTerrainAltitude = ConfigNodeUtil.ParseValue <float>(node, "minTerrainAltitude", 0.0f);
                maxTerrainAltitude = ConfigNodeUtil.ParseValue <float>(node, "maxTerrainAltitude", float.MaxValue);
                minSpeed           = ConfigNodeUtil.ParseValue <double>(node, "minSpeed", 0.0);
                maxSpeed           = ConfigNodeUtil.ParseValue <double>(node, "maxSpeed", double.MaxValue);
                minRateOfClimb     = ConfigNodeUtil.ParseValue <double>(node, "minRateOfClimb", double.MinValue);
                maxRateOfClimb     = ConfigNodeUtil.ParseValue <double>(node, "maxRateOfClimb", double.MaxValue);
                minAcceleration    = ConfigNodeUtil.ParseValue <float>(node, "minAcceleration", 0.0f);
                maxAcceleration    = ConfigNodeUtil.ParseValue <float>(node, "maxAcceleration", float.MaxValue);

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
Example #6
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                trait         = ConfigNodeUtil.ParseValue <string>(node, "trait", (string)null);
                minExperience = Convert.ToInt32(node.GetValue("minExperience"));
                maxExperience = Convert.ToInt32(node.GetValue("maxExperience"));
                minCrew       = Convert.ToInt32(node.GetValue("minCrew"));
                maxCrew       = Convert.ToInt32(node.GetValue("maxCrew"));

                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                {
                    kerbals.Add(Kerbal.Load(kerbalNode));
                }
                foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL_EXCLUDE"))
                {
                    excludeKerbals.Add(Kerbal.Load(kerbalNode));
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
Example #7
0
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            foreach (ConfigNode child in configNode.GetNodes("KERBAL_DETAIL"))
            {
                // Read all the orbit data
                KerbalData kd = new KerbalData();
                kd.name        = child.GetValue("name");
                kd.body        = ConfigNodeUtil.ParseValue <CelestialBody>(child, "body");
                kd.latitude    = ConfigNodeUtil.ParseValue <double>(child, "lat");
                kd.longitude   = ConfigNodeUtil.ParseValue <double>(child, "lon");
                kd.altitude    = ConfigNodeUtil.ParseValue <double?>(child, "alt", (double?)null);
                kd.landed      = ConfigNodeUtil.ParseValue <bool>(child, "landed");
                kd.owned       = ConfigNodeUtil.ParseValue <bool>(child, "owned");
                kd.addToRoster = ConfigNodeUtil.ParseValue <bool>(child, "addToRoster");

                if (child.HasNode("ORBIT"))
                {
                    kd.orbit = new OrbitSnapshot(child.GetNode("ORBIT")).Load();
                }

                // Find the ProtoCrewMember
                kd.crewMember = HighLogic.CurrentGame.CrewRoster.AllKerbals().Where(cm => cm.name == kd.name).First();

                // Add to the global list
                kerbals.Add(kd);
            }
        }
        protected override void OnLoadFromConfig(ConfigNode node)
        {
            base.OnLoadFromConfig(node);

            currency = ConfigNodeUtil.ParseValue <Currency>(node, "currency");
            advance  = ConfigNodeUtil.ParseValue <double>(node, "advance");
        }
 public override void OnLoad(ConfigNode node)
 {
     try
     {
         base.OnLoad(node);
         nextCheck = ConfigNodeUtil.ParseValue <int>(node, "nextCheck", 0);
         foreach (ConfigNode child in node.GetNodes("CelestialBodyInfo"))
         {
             CelestialBodyInfo cbi = new CelestialBodyInfo();
             try
             {
                 cbi.body = ConfigNodeUtil.ParseValue <CelestialBody>(child, "body");
             }
             catch (Exception e)
             {
                 LoggingUtil.LogWarning(this, "Error loading celestial body, skipping.  Error was:");
                 LoggingUtil.LogException(e);
                 continue;
             }
             cbi.coverage              = ConfigNodeUtil.ParseValue <UInt32>(child, "coverage", 0);
             cbi.activeRange           = ConfigNodeUtil.ParseValue <double>(child, "activeRange");
             celestialBodies[cbi.body] = cbi;
         }
     }
     catch (Exception e)
     {
         LoggingUtil.LogError(this, "Error loading RemoteTechProgressTracker from persistance file!");
         LoggingUtil.LogException(e);
         ExceptionLogWindow.DisplayFatalException(ExceptionLogWindow.ExceptionSituation.SCENARIO_MODULE_LOAD, e, "RemoteTechProgressTracker");
     }
 }
Example #10
0
 protected override void OnParameterLoad(ConfigNode node)
 {
     duration  = Convert.ToDouble(node.GetValue("duration"));
     endTime   = Convert.ToDouble(node.GetValue("endTime"));
     timerType = ConfigNodeUtil.ParseValue <TimerType>(node, "timerType", TimerType.CONTRACT_ACCEPTANCE);
     parameter = ConfigNodeUtil.ParseValue <string>(node, "parameter", "");
 }
Example #11
0
        public override bool Load(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue <string>(configNode, "basename", x => basename = x, this);

            int index = 0;

            foreach (ConfigNode child in ConfigNodeUtil.GetChildNodes(configNode, "CONDITION"))
            {
                DataNode childDataNode = new DataNode("CONDITION_" + index++, dataNode, this);
                try
                {
                    ConfigNodeUtil.SetCurrentDataNode(childDataNode);
                    UnlockBase.ConditionDetail cd = new UnlockBase.ConditionDetail();
                    valid &= ConfigNodeUtil.ParseValue <UnlockBase.ConditionDetail.Condition>(child, "condition", x => cd.condition = x, this);
                    valid &= ConfigNodeUtil.ParseValue <string>(child, "parameter", x => cd.parameter = x, this, "", x => ValidateMandatoryParameter(x, cd.condition));
                    conditions.Add(cd);
                }
                finally
                {
                    ConfigNodeUtil.SetCurrentDataNode(dataNode);
                }
            }
            valid &= ConfigNodeUtil.ValidateMandatoryChild(configNode, "CONDITION", this);

            return(valid);
        }
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            url       = ConfigNodeUtil.ParseValue <string>(configNode, "url");
            craftType = ConfigNodeUtil.ParseValue <CraftType>(configNode, "craftType");
        }
Example #13
0
 protected override void OnParameterLoad(ConfigNode node)
 {
     base.OnParameterLoad(node);
     minAntennaPower = Convert.ToDouble(node.GetValue("minAntennaPower"));
     maxAntennaPower = node.HasValue("maxAntennaPower") ? Convert.ToDouble(node.GetValue("maxAntennaPower")) : double.MaxValue;
     antennaType     = ConfigNodeUtil.ParseValue <AntennaType>(node, "antennaType", AntennaType.TRANSMIT);
 }
Example #14
0
        protected override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            title      = node.GetValue("title");
            coverage   = ConfigNodeUtil.ParseValue <double>(node, "coverage");
            targetBody = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody");
        }
        protected override void OnLoad(ConfigNode configNode)
        {
            base.OnLoad(configNode);

            targetBody  = ConfigNodeUtil.ParseValue <CelestialBody>(configNode, "targetBody");
            field       = ConfigNodeUtil.ParseValue <RadiationFieldType>(configNode, "field", RadiationFieldType.UNDEFINED);
            set_visible = ConfigNodeUtil.ParseValue <bool>(configNode, "set_visible", true);
        }
 protected override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     title       = node.GetValue("title");
     minApoapsis = Convert.ToDouble(node.GetValue("minApoapsis"));
     maxApoapsis = node.HasValue("maxApoapsis") ? Convert.ToDouble(node.GetValue("maxApoapsis")) : double.MaxValue;
     targetBody  = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody");
 }
Example #17
0
 protected override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     title       = node.GetValue("title");
     minQuantity = Convert.ToDouble(node.GetValue("minQuantity"));
     maxQuantity = node.HasValue("maxQuantity") ? Convert.ToDouble(node.GetValue("maxQuantity")) : double.MaxValue;
     resource    = ConfigNodeUtil.ParseValue <PartResourceDefinition>(node, "resource");
 }
Example #18
0
 protected override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     title          = node.GetValue("title");
     minInclination = Convert.ToDouble(node.GetValue("minInclination"));
     maxInclination = Convert.ToDouble(node.GetValue("maxInclination"));
     targetBody     = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody");
 }
 public override void OnLoad(ConfigNode configNode)
 {
     base.OnLoad(configNode);
     actorName = ConfigNodeUtil.ParseValue <string>(configNode, "actorName");
     latitude  = ConfigNodeUtil.ParseValue <double>(configNode, "latitude");
     longitude = ConfigNodeUtil.ParseValue <double>(configNode, "longitude");
     altitude  = ConfigNodeUtil.ParseValue <double>(configNode, "altitude");
 }
Example #20
0
 protected override void OnParameterLoad(ConfigNode node)
 {
     duration       = Convert.ToDouble(node.GetValue("duration"));
     endTime        = Convert.ToDouble(node.GetValue("endTime"));
     preWaitText    = ConfigNodeUtil.ParseValue <string>(node, "preWaitText", (string)null);
     waitingText    = ConfigNodeUtil.ParseValue <string>(node, "waitingText", (string)null);
     completionText = ConfigNodeUtil.ParseValue <string>(node, "completionText", (string)null);
 }
Example #21
0
        public override bool Load(ConfigNode configNode)
        {
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue <double>(configNode, "descentAngle", x => descentAngle = x, this, 2, x => Validation.GT(x, 0) && Validation.LT(x, 90));

            return(valid);
        }
Example #22
0
 protected override void OnParameterLoad(ConfigNode node)
 {
     trait         = ConfigNodeUtil.ParseValue <string>(node, "trait", (string)null);
     minExperience = Convert.ToInt32(node.GetValue("minExperience"));
     maxExperience = Convert.ToInt32(node.GetValue("maxExperience"));
     minCount      = Convert.ToInt32(node.GetValue("minCount"));
     maxCount      = Convert.ToInt32(node.GetValue("maxCount"));
 }
        public override bool LoadFromConfig(ConfigNode configNode)
        {
            bool valid = base.LoadFromConfig(configNode);

            valid &= ConfigNodeUtil.ParseValue <string>(configNode, "basename", x => basename = x, this);

            return(valid);
        }
Example #24
0
        public override bool Load(ConfigNode configNode)
        {
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue <double>(configNode, "distance", x => distance = x, this, 1, x => Validation.GE(x, 1));

            return(valid);
        }
 protected override void OnParameterLoad(ConfigNode node)
 {
     base.OnParameterLoad(node);
     distance         = Convert.ToDouble(node.GetValue("distance"));
     waypointIndex    = Convert.ToInt32(node.GetValue("waypointIndex"));
     hideOnCompletion = ConfigNodeUtil.ParseValue <bool?>(node, "hideOnCompletion", (bool?)true).Value;
     showMessages     = ConfigNodeUtil.ParseValue <bool?>(node, "showMessages", (bool?)false).Value;
 }
        public override bool LoadFromConfig(ConfigNode configNode)
        {
            // Load base class
            bool valid = base.LoadFromConfig(configNode);

            valid &= ConfigNodeUtil.ParseValue <RadiationFieldType>(configNode, "field", x => field = x, this, RadiationFieldType.ANY, ValidateField);
            return(valid);
        }
        protected override void OnParameterLoad(ConfigNode node)
        {
            base.OnParameterLoad(node);

            resource = ConfigNodeUtil.ParseValue <PartResourceDefinition>(node, "resource");
            minRate  = ConfigNodeUtil.ParseValue <double>(node, "minRate", double.MinValue);
            maxRate  = ConfigNodeUtil.ParseValue <double>(node, "maxRate", double.MaxValue);
        }
        protected override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);

            title          = node.GetValue("title");
            minSignalDelay = ConfigNodeUtil.ParseValue <double>(node, "minSignalDelay");
            maxSignalDelay = ConfigNodeUtil.ParseValue <double>(node, "maxSignalDelay");
        }
            public override void OnLoad(ConfigNode configNode)
            {
                base.OnLoad(configNode);

                crewIndex   = ConfigNodeUtil.ParseValue <int>(configNode, "crewIndex");
                excludeName = ConfigNodeUtil.ParseValue <List <string> >(configNode, "excludeName", new List <string>());
                gender      = ConfigNodeUtil.ParseValue <ProtoCrewMember.Gender>(configNode, "gender", ProtoCrewMember.Gender.Male);
            }
Example #30
0
        public override bool Load(ConfigNode configNode)
        {
            bool valid = base.Load(configNode);

            valid &= ConfigNodeUtil.ParseValue <double>(configNode, "mach", x => mach = x, this);

            return(valid);
        }