protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                if (state == ParameterState.Complete || ParameterCount == 1)
                {
                    if (ParameterCount == 1)
                    {
                        hideChildren = true;
                    }

                    output = ParameterDelegate <Vessel> .GetDelegateText(this);
                }
                else
                {
                    output = Localizer.GetStringByTag("#cc.param.HasResource");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        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);
            }
        }
Exemple #3
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                situation       = ConfigNodeUtil.ParseValue <Vessel.Situations>(node, "situation", Vessel.Situations.ORBITING);
                minAltitude     = ConfigNodeUtil.ParseValue <double>(node, "minAltitude");
                maxAltitude     = ConfigNodeUtil.ParseValue <double>(node, "maxAltitude", double.MaxValue);
                minApoapsis     = ConfigNodeUtil.ParseValue <double>(node, "minApoapsis");
                maxApoapsis     = ConfigNodeUtil.ParseValue <double>(node, "maxApoapsis", double.MaxValue);
                minPeriapsis    = ConfigNodeUtil.ParseValue <double>(node, "minPeriapsis");
                maxPeriapsis    = ConfigNodeUtil.ParseValue <double>(node, "maxPeriapsis", double.MaxValue);
                minEccentricity = ConfigNodeUtil.ParseValue <double>(node, "minEccentricity");
                maxEccentricity = ConfigNodeUtil.ParseValue <double>(node, "maxEccentricity", double.MaxValue);
                minInclination  = ConfigNodeUtil.ParseValue <double>(node, "minInclination");
                maxInclination  = ConfigNodeUtil.ParseValue <double>(node, "maxInclination", double.MaxValue);
                minPeriod       = ConfigNodeUtil.ParseValue <double>(node, "minPeriod");
                maxPeriod       = ConfigNodeUtil.ParseValue <double>(node, "maxPeriod", double.MaxValue);
                targetBody      = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody", (CelestialBody)null);
                displayNotes    = ConfigNodeUtil.ParseValue <bool?>(node, "displayNotes", (bool?)false).Value;

                if (node.HasNode("ORBIT"))
                {
                    orbit           = new OrbitSnapshot(node.GetNode("ORBIT")).Load();
                    deviationWindow = ConfigNodeUtil.ParseValue <double>(node, "deviationWindow");
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
Exemple #4
0
        private void OnVesselRecovered(ProtoVessel v)
        {
            foreach (ProtoCrewMember crew in v.GetVesselCrew())
            {
                if (recovered.ContainsKey(crew.name))
                {
                    recovered[crew.name] = true;
                }
            }

            // Retest the conditions
            bool success = ParameterDelegate <string> .CheckChildConditions(this, "");

            if (ChildChanged || success)
            {
                ChildChanged = false;
                if (success)
                {
                    SetState(ParameterState.Complete);
                }
                else
                {
                    ContractConfigurator.OnParameterChange.Fire(Root, this);
                }
            }

            ContractConfigurator.OnParameterChange.Fire(Root, this);
        }
Exemple #5
0
        protected virtual void OnVesselWillDestroy(Vessel v)
        {
            LoggingUtil.LogVerbose(this, "OnVesselWillDestroy: " + v.id);
            foreach (string key in ContractVesselTracker.Instance.GetAssociatedKeys(v))
            {
                LoggingUtil.LogVerbose(this, "adding to destroyedTargets: " + key);
                destroyedTargets.AddUnique(key);
            }

            bool success = ParameterDelegate <string> .CheckChildConditions(this, "");

            if (ChildChanged || success)
            {
                ChildChanged = false;
                if (success)
                {
                    SetState(ParameterState.Complete);
                }
                else
                {
                    ContractConfigurator.OnParameterChange.Fire(Root, this);
                }
            }

            ContractConfigurator.OnParameterChange.Fire(Root, this);
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Vessel State";
                if (state == ParameterState.Complete || ParameterCount == 1)
                {
                    if (ParameterCount == 1)
                    {
                        output       = ParameterDelegate <Vessel> .GetDelegateText(this);;
                        hideChildren = true;
                    }
                    else
                    {
                        output = Localizer.Format("#cc.param.ReachState.detail", ParameterDelegate <Vessel> .GetDelegateText(this));
                    }
                }
                else
                {
                    Localizer.GetStringByTag("#cc.param.ReachState");
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override IEnumerable <T> SetState(IEnumerable <T> values, ref bool conditionMet, bool checkOnly = false)
        {
            IEnumerable <T> newValues = ParameterDelegate <T> .CheckChildConditions(this, values, ref conditionMet, checkOnly);

            base.SetState(newValues, ref conditionMet, checkOnly);
            return(newValues);
        }
Exemple #8
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                index = Convert.ToInt32(node.GetValue("index"));
                count = Convert.ToInt32(node.GetValue("count"));

                // Legacy support from Contract Configurator 1.8.3
                if (node.HasValue("passenger"))
                {
                    passengers = ConfigNodeUtil.ParseValue <List <string> >(node, "passenger", new List <string>()).Select(
                        name => new Kerbal(name)
                        ).ToList();
                }
                else
                {
                    foreach (ConfigNode kerbalNode in node.GetNodes("KERBAL"))
                    {
                        passengers.Add(Kerbal.Load(kerbalNode));
                    }
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Parts";
                if (state == ParameterState.Complete)
                {
                    output += ": ";
                    if (maxCount == int.MaxValue && minCount != 1)
                    {
                        output += "At least " + minCount + " ";
                    }
                    else if (maxCount != int.MaxValue && minCount == 1)
                    {
                        output += "At most " + maxCount + " ";
                    }
                    output += ParameterDelegate <Part> .GetDelegateText(this);
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        protected override void OnParameterLoad(ConfigNode node)
        {
            base.OnParameterLoad(node);
            minCount = Convert.ToInt32(node.GetValue("minCount"));
            maxCount = Convert.ToInt32(node.GetValue("maxCount"));

            filters = new List <Filter>();

            foreach (ConfigNode child in node.GetNodes("FILTER"))
            {
                Filter filter = new Filter();
                filter.type = ConfigNodeUtil.ParseValue <ParameterDelegateMatchType>(child, "type");

                filter.part         = ConfigNodeUtil.ParseValue <AvailablePart>(child, "part", (AvailablePart)null);
                filter.partModules  = child.GetValues("partModule").ToList();
                filter.category     = ConfigNodeUtil.ParseValue <PartCategories?>(child, "category", (PartCategories?)null);
                filter.manufacturer = ConfigNodeUtil.ParseValue <string>(child, "manufacturer", (string)null);
                filter.minCount     = ConfigNodeUtil.ParseValue <int>(child, "minCount", 1);
                filter.maxCount     = ConfigNodeUtil.ParseValue <int>(child, "maxCount", int.MaxValue);

                filters.Add(filter);
            }

            ParameterDelegate <Part> .OnDelegateContainerLoad(node);

            CreateDelegates();
        }
        private void CheckSubject(Vessel vessel, string subjectID)
        {
            LoggingUtil.LogVerbose(this, "OnScienceReceived: " + subjectID + ", " + vessel.id);

            // Check the experiment type
            if (!string.IsNullOrEmpty(experiment) && !subjectID.StartsWith(experiment + "@"))
            {
                return;
            }

            // Temporarily set to test mode
            testMode = true;

            // Check whether we meet the conditions (with the exception of recovery)
            bool experimentPassed = ParameterDelegate <Vessel> .CheckChildConditions(this, vessel, true);

            // Reset test mode
            testMode = false;

            // Add the subject if it passed
            if (experimentPassed)
            {
                vesselData[vessel.id].subjects[subjectID] = true;
            }
        }
        protected override string GetParameterTitle()
        {
            string output = null;

            if (string.IsNullOrEmpty(title))
            {
                output = "Vessel State";
                if (state == ParameterState.Complete || ParameterCount == 1)
                {
                    if (ParameterCount == 1)
                    {
                        output       = "";
                        hideChildren = true;
                    }
                    else
                    {
                        output += ": ";
                    }

                    output += ParameterDelegate <Vessel> .GetDelegateText(this);
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
Exemple #13
0
        protected override string GetParameterTitle()
        {
            string output = "";

            if (string.IsNullOrEmpty(title))
            {
                if (passengers.Count == 0)
                {
                    output = "Load " + (count == 0 ? "all" : count.ToString()) + " passenger" + (count != 1 ? "s" : "") + " while on the launchpad/runway";
                }
                else if (passengers.Count == 1)
                {
                    output = "Passenger " + ParameterDelegate <Vessel> .GetDelegateText(this);

                    hideChildren = true;
                }
                else if (state == ParameterState.Complete)
                {
                    output = "Passengers: " + passengers.Count;
                }
                else
                {
                    output = "Passengers";
                }
            }
            else
            {
                output = title;
            }
            return(output);
        }
        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);
            }
        }
        protected override void OnParameterLoad(ConfigNode node)
        {
            base.OnParameterLoad(node);
            targetBody     = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody", (CelestialBody)null);
            biome          = ConfigNodeUtil.ParseValue <string>(node, "biome", "");
            situation      = ConfigNodeUtil.ParseValue <ExperimentSituations?>(node, "situation", (ExperimentSituations?)null);
            location       = ConfigNodeUtil.ParseValue <BodyLocation?>(node, "location", (BodyLocation?)null);
            experiment     = ConfigNodeUtil.ParseValue <string>(node, "experiment", "");
            recoveryMethod = ConfigNodeUtil.ParseValue <RecoveryMethod>(node, "recoveryMethod");

            foreach (ConfigNode child in node.GetNodes("VESSEL_DATA"))
            {
                Guid vid = ConfigNodeUtil.ParseValue <Guid>(child, "vessel");
                if (vid != null && FlightGlobals.Vessels.Where(v => v.id == vid).Any())
                {
                    vesselData[vid] = new VesselData();
                    foreach (string subject in ConfigNodeUtil.ParseValue <List <string> >(child, "subject", new List <string>()))
                    {
                        vesselData[vid].subjects[subject] = true;
                    }
                    vesselData[vid].recovery = ConfigNodeUtil.ParseValue <bool>(child, "recovery");
                }
            }

            ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);

            CreateDelegates();
        }
        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);
            }
        }
Exemple #17
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                targetBody     = ConfigNodeUtil.ParseValue <CelestialBody>(node, "targetBody", (CelestialBody)null);
                biome          = ConfigNodeUtil.ParseValue <string>(node, "biome", "").Replace(" ", "");
                situation      = ConfigNodeUtil.ParseValue <ExperimentSituations?>(node, "situation", (ExperimentSituations?)null);
                location       = ConfigNodeUtil.ParseValue <BodyLocation?>(node, "location", (BodyLocation?)null);
                experiment     = ConfigNodeUtil.ParseValue <List <string> >(node, "experiment", new string[] { "" }.ToList());
                recoveryMethod = ConfigNodeUtil.ParseValue <ScienceRecoveryMethod>(node, "recoveryMethod");

                List <string> recoveredExp = ConfigNodeUtil.ParseValue <List <string> >(node, "recovery", new List <string>());
                foreach (string exp in recoveredExp)
                {
                    recoveryDone[exp] = true;
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);
            }
        }
Exemple #18
0
        /// <summary>
        /// Whether this vessel meets the parameter condition.
        /// </summary>
        /// <param name="vessel">The vessel to check</param>
        /// <returns>Whether the vessel meets the condition</returns>
        protected override bool VesselMeetsCondition(Vessel vessel)
        {
            LoggingUtil.LogVerbose(this, "Checking VesselMeetsCondition: " + vessel.id);

            ParameterDelegate <Vessel> .CheckChildConditions(this, vessel);

            return(recoveryDone.Count == experiment.Count);
        }
Exemple #19
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            vessels          = ConfigNodeUtil.ParseValue <List <string> >(node, "vessel", new List <string>());
            destroyedTargets = ConfigNodeUtil.ParseValue <List <string> >(node, "destroyedTarget", new List <string>());

            ParameterDelegate <string> .OnDelegateContainerLoad(node);

            CreateDelegates();
        }
        protected override void OnParameterLoad(ConfigNode node)
        {
            try
            {
                base.OnParameterLoad(node);
                minCount = Convert.ToInt32(node.GetValue("minCount"));
                maxCount = Convert.ToInt32(node.GetValue("maxCount"));

                filters = new List <Filter>();

                foreach (ConfigNode child in node.GetNodes("FILTER"))
                {
                    Filter filter = new Filter();
                    filter.type = ConfigNodeUtil.ParseValue <ParameterDelegateMatchType>(child, "type");

                    filter.parts           = ConfigNodeUtil.ParseValue <List <AvailablePart> >(child, "part", new List <AvailablePart>());
                    filter.partModules     = child.GetValues("partModule").ToList();
                    filter.partModuleTypes = child.GetValues("partModuleType").ToList();
                    filter.category        = ConfigNodeUtil.ParseValue <PartCategories?>(child, "category", (PartCategories?)null);
                    filter.manufacturer    = ConfigNodeUtil.ParseValue <string>(child, "manufacturer", (string)null);
                    filter.minCount        = ConfigNodeUtil.ParseValue <int>(child, "minCount", 1);
                    filter.maxCount        = ConfigNodeUtil.ParseValue <int>(child, "maxCount", int.MaxValue);

                    foreach (ConfigNode moduleNode in child.GetNodes("MODULE"))
                    {
                        List <Tuple <string, string, string> > tmp = new List <Tuple <string, string, string> >();
                        string nextLabel = "";
                        foreach (ConfigNode.Value v in moduleNode.values)
                        {
                            if (v.name == "name")
                            {
                                tmp.Add(new Tuple <string, string, string>(v.name, "", v.value));
                            }
                            else if (v.name == "label")
                            {
                                nextLabel = v.value;
                            }
                            else
                            {
                                tmp.Add(new Tuple <string, string, string>(v.name, nextLabel, v.value));
                                nextLabel = "";
                            }
                        }
                        filter.partModuleExtended.Add(tmp);
                    }

                    filters.Add(filter);
                }

                CreateDelegates();
            }
            finally
            {
                ParameterDelegate <Part> .OnDelegateContainerLoad(node);
            }
        }
Exemple #21
0
        protected void UpdateDelegates()
        {
            foreach (ContractParameter genericParam in this.GetAllDescendents())
            {
                ParameterDelegate <Vessel> param = genericParam as ParameterDelegate <Vessel>;
                if (param == null)
                {
                    continue;
                }

                string oldTitle = param.Title;
                if (matchingSubjects.Count == experiment.Count)
                {
                    if (param.ID.Contains("Destination:") || param.ID.Contains("Biome:") || param.ID.Contains("Situation:") ||
                        param.ID.Contains("Location:"))
                    {
                        param.ClearTitle();
                    }
                    else if (param.ID.Contains("Subject"))
                    {
                        string exp = param.ID.Remove(param.ID.IndexOf("Subject"));

                        param.SetTitle(matchingSubjects[exp].title);
                        param.SetState(ParameterState.Complete);
                    }
                }
                else
                {
                    if (param.ID.Contains("Subject"))
                    {
                        string exp = param.ID.Remove(param.ID.IndexOf("Subject"));
                        if (matchingSubjects.ContainsKey(exp))
                        {
                            param.SetTitle(matchingSubjects[exp].title);
                            param.SetState(ParameterState.Complete);
                        }
                        else
                        {
                            param.ClearTitle();
                        }
                    }
                    else
                    {
                        param.ResetTitle();
                    }
                }

                if (param.Title != oldTitle)
                {
                    ContractsWindow.SetParameterTitle(param, param.Title);
                    ContractConfigurator.OnParameterChange.Fire(Root, param);
                }
            }

            ContractsWindow.SetParameterTitle(this, GetTitle());
        }
Exemple #22
0
        protected override void OnParameterLoad(ConfigNode node)
        {
            base.OnParameterLoad(node);
            count      = Convert.ToInt32(node.GetValue("count"));
            passengers = ConfigNodeUtil.ParseValue <List <ProtoCrewMember> >(node, "passenger", new List <ProtoCrewMember>());

            ParameterDelegate <Vessel> .OnDelegateContainerLoad(node);

            CreateDelegates();
        }
        protected override void SetState(IEnumerable <T> values, ref bool conditionMet, bool checkOnly = false)
        {
            BitArray current = ParameterDelegate <T> .CheckChildConditions(this, values, ref conditionMet, checkOnly);

            if (current != null)
            {
                src.And(current);
            }
            base.SetState(values, ref conditionMet, checkOnly);
        }
Exemple #24
0
        protected override string GetParameterTitle()
        {
            string title = base.GetParameterTitle();

            if (state != ParameterState.Incomplete)
            {
                title += ": " + ParameterDelegate <T> .GetDelegateText(this);
            }

            return(title);
        }
Exemple #25
0
        /// <summary>
        /// Whether this vessel meets the parameter condition.
        /// </summary>
        /// <param name="vessel">The vessel to check.</param>
        /// <returns>Whether the vessel meets the conditions.</returns>
        protected override bool VesselMeetsCondition(Vessel vessel)
        {
            LoggingUtil.LogVerbose(this, "Checking VesselMeetsCondition: " + vessel.id);

            // No passengers loaded
            if (passengers.Count == 0)
            {
                return(false);
            }

            return(ParameterDelegate <Vessel> .CheckChildConditions(this, vessel));
        }
Exemple #26
0
        protected void CreateDelegates()
        {
            // Filter for celestial bodies
            if (targetBody != null && string.IsNullOrEmpty(biome))
            {
                AddParameter(new ParameterDelegate <Vessel>("Destination: " + targetBody.CleanDisplayName(),
                                                            subj => FlightGlobals.currentMainBody == targetBody, true));
            }

            // Filter for biome
            if (!string.IsNullOrEmpty(biome))
            {
                Biome  b     = new Biome(targetBody, biome);
                string title = b.IsKSC() ? "Location: " : "Biome: ";

                AddParameter(new ParameterDelegate <Vessel>(title + b,
                                                            subj => CheckBiome(FlightGlobals.ActiveVessel)));
            }

            // Filter for situation
            if (situation != null)
            {
                AddParameter(new ParameterDelegate <Vessel>("Situation: " + situation.Value.Print(),
                                                            subj => FlightGlobals.ActiveVessel != null && ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel) == situation));
            }

            // Filter for location
            if (location != null)
            {
                AddParameter(new ParameterDelegate <Vessel>("Location: " + location,
                                                            subj => FlightGlobals.ActiveVessel != null && ((location != BodyLocation.Surface) ^ FlightGlobals.ActiveVessel.LandedOrSplashed)));
            }

            // Add the experiments
            foreach (string exp in experiment)
            {
                string            experimentStr   = string.IsNullOrEmpty(exp) ? "Any" : ExperimentName(exp);
                ContractParameter experimentParam = AddParameter(new ParameterDelegate <Vessel>("Experiment: " +
                                                                                                experimentStr, subj => recoveryDone.ContainsKey(exp)));

                // Add the subject
                ContractParameter subjectParam = new ParameterDelegate <Vessel>("", subj => true);
                subjectParam.ID = exp + "Subject";
                experimentParam.AddParameter(subjectParam);

                // Filter for recovery
                if (recoveryMethod != ScienceRecoveryMethod.None)
                {
                    ContractParameter recoveryParam = experimentParam.AddParameter(new ParameterDelegate <Vessel>("Recovery: " +
                                                                                                                  RecoveryMethod(exp).Print(), subj => false));
                }
            }
        }
        protected void CreateTimerParameter()
        {
            if (duration > 0.0)
            {
                durationParameter = new ParameterDelegate <Vessel>("Duration: " + DurationUtil.StringValue(duration),
                                                                   v => false);
                durationParameter.Optional     = true;
                durationParameter.fakeOptional = true;

                AddParameter(durationParameter);
            }
        }
        protected void CreateVesselListParameter()
        {
            if (vesselList.Any())
            {
                if (vesselList.Count() == 1)
                {
                    vesselListParam = new ParameterDelegate <Vessel>(hideVesselName ? "" : Localizer.Format("#cc.param.VesselParameterGroup.default", ContractVesselTracker.GetDisplayName(vesselList.First())), v =>
                    {
                        bool check = VesselCanBeConsidered(v);
                        if (!hideVesselName)
                        {
                            vesselListParam.SetTitle(Localizer.Format((FlightGlobals.ActiveVessel == v && trackedVessel != null ? "#cc.param.VesselParameterGroup.default" : "#cc.param.VesselParameterGroup.trackedVessel"),
                                                                      ContractVesselTracker.GetDisplayName(vesselList.First())));
                        }
                        return(check);
                    });
                    vesselListParam.Optional     = true;
                    vesselListParam.fakeOptional = true;

                    AddParameter(vesselListParam);
                }
                else
                {
                    vesselListParam = new ParameterDelegate <Vessel>(hideVesselName ? "" : Localizer.GetStringByTag("#cc.param.VesselParameterGroup.anyVesselListEmpty"), v =>
                    {
                        bool check = VesselCanBeConsidered(v);
                        if (!hideVesselName)
                        {
                            if (check)
                            {
                                vesselListParam.SetTitle(Localizer.Format("#cc.param.VesselParameterGroup.anyVesselList", ParameterDelegate <Vessel> .GetDelegateText(vesselListParam)));
                            }
                            else
                            {
                                Localizer.GetStringByTag("#cc.param.VesselParameterGroup.anyVesselListEmpty");
                            }
                        }
                        return(check);
                    });
                    vesselListParam.Optional     = true;
                    vesselListParam.fakeOptional = true;

                    foreach (string vessel in vesselList)
                    {
                        ContractParameter childParam = new ParameterDelegate <Vessel>(ContractVesselTracker.GetDisplayName(vessel), v => false);
                        vesselListParam.AddParameter(childParam);
                    }

                    AddParameter(vesselListParam);
                }
            }
        }
        protected void CreateTimerParameter()
        {
            if (duration > 0.0)
            {
                durationParameter = new ParameterDelegate <Vessel>(
                    Localizer.Format("#cc.param.VesselParameterGroup.duration", DurationUtil.StringValue(duration)),
                    v => false);
                durationParameter.Optional     = true;
                durationParameter.fakeOptional = true;

                AddParameter(durationParameter);
            }
        }
        /// <summary>
        /// Whether this vessel meets the parameter condition.
        /// </summary>
        /// <param name="vessel">The vessel to check</param>
        /// <returns>Whether the vessel meets the condition</returns>
        protected override bool VesselMeetsCondition(Vessel vessel)
        {
            LoggingUtil.LogVerbose(this, "Checking VesselMeetsCondition: " + vessel.id);

            // If we're a VesselParameterGroup child, only do actual state change if we're the tracked vessel
            bool checkOnly = false;

            if (Parent is VesselParameterGroup)
            {
                checkOnly = ((VesselParameterGroup)Parent).TrackedVessel != vessel;
            }

            return(ParameterDelegate <ProtoCrewMember> .CheckChildConditions(this, GetVesselCrew(vessel, maxCrew == int.MaxValue), checkOnly));
        }