protected override string GetTitle() { // Set the first part of the output string output; if (!string.IsNullOrEmpty(title)) { output = title; } else { // Set the vessel name output = "Vessel: "; if ((waiting || state == ParameterState.Complete) && trackedVessel != null) { output += trackedVessel.vesselName; } else if (!string.IsNullOrEmpty(define)) { output += define + " (new)"; } else if (vesselList.Any()) { bool first = true; foreach (string vesselName in vesselList) { if (!first) { output += " OR "; } output += vesselName; first = false; } } else { output += "Any"; } } // Not yet complete, add duration if (state != ParameterState.Complete) { // Add duration if (duration > 0.0) { output += "; Duration: " + DurationUtil.StringValue(duration); } } // If we're complete and a custom title hasn't been provided, try to get a better title else if (!string.IsNullOrEmpty(title)) { if (ParameterCount == 1) { return(GetParameter(0).Title); } } return(output); }
protected override string GetNotes() { if (duration > 0.0 && Root.ContractState == Contract.State.Active) { if (trackedVessel == null) { return("No vessel currently matching parameters."); } else if (!waiting) { return("Active Vessel:"); } else { string note = "Time remaining for " + trackedVessel.vesselName + ": " + DurationUtil.StringValue(completionTime - Planetarium.GetUniversalTime()); // Add the string that we returned to the noteTracker. This is used to update // the contract notes element in the GUI directly, as it does support dynamic // text. noteTracker[notePrefix + note] = note; return(note); } } return(base.GetNotes()); }
protected override string GetParameterTitle() { Vessel currentVessel = CurrentVessel(); string title = null; if (currentVessel != null && endTimes.ContainsKey(currentVessel.id) && endTimes[currentVessel.id] > 0.01 || currentVessel == null && endTime > 0.01) { double time = currentVessel != null ? endTimes[currentVessel.id] : endTime; if (time - Planetarium.GetUniversalTime() > 0.0) { title = (waitingText ?? "Time to completion:") + " " + DurationUtil.StringValue(time - Planetarium.GetUniversalTime()); } else { title = completionText ?? "Wait time over"; } } else { title = (preWaitText ?? "Waiting time required:") + " " + DurationUtil.StringValue(duration); } return(title); }
protected override string GetTitle() { if (endTime > 0.01) { string title = null; if (endTime - Planetarium.GetUniversalTime() > 0.0) { title = (waitingText ?? "Time to completion:") + " " + DurationUtil.StringValue(endTime - Planetarium.GetUniversalTime()); } else { title = completionText ?? "Wait time over"; } // Add the string that we returned to the titleTracker. This is used to update // the contract title element in the GUI directly, as it does not support dynamic // text. titleTracker.Add(title); return(title); } else { return((preWaitText ?? "Waiting time required:") + " " + DurationUtil.StringValue(duration)); } }
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); } }
/// <summary> Cache some strings for performance gains (less memory churning) </summary> private void InitStrings() { if (!string.IsNullOrEmpty(KerCon_AllowsInterruptionsUpTo)) { return; } KerCon_AllowsInterruptionsUpTo = Localizer.Format("#KerCon_AllowsInterruptionsUpTo", // Allows interruptions up to <<1>> DurationUtil.StringValue(allowedDowntime)); KerCon_TimeStartsAfterAccepting = Localizer.Format("#KerCon_TimeStartsAfterAccepting", // Time starts <<1>> after accepting the contract" Lib.Color(DurationUtil.StringValue(waitDuration), Lib.Kolor.Yellow)); KerCon_Duration_X = Localizer.Format("#KerCon_Duration_X", DurationUtil.StringValue(duration)); }
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); } }
protected override string GetParameterTitle() { if (state == ParameterState.Failed) { return("Time expired!"); } else if (endTime > 0.01) { return("Time remaining: " + DurationUtil.StringValue(endTime - Planetarium.GetUniversalTime())); } else { return("Time limit: " + DurationUtil.StringValue(duration)); } }
protected override string GetParameterTitle() { if (state == ParameterState.Failed) { return(Localizer.GetStringByTag("#cc.param.Timer.expired")); } else if (endTime > 0.01) { return(Localizer.Format("#cc.param.Timer.active", DurationUtil.StringValue(endTime - Planetarium.GetUniversalTime()))); } else { return(Localizer.Format("#cc.param.Timer.inactive", DurationUtil.StringValue(duration))); } }
protected override string GetParameterTitle() { double end = endTime == 0.0 ? Planetarium.GetUniversalTime() : endTime; string prefix = string.IsNullOrEmpty(title) ? Localizer.GetStringByTag("#cc.param.MissionTimer") : title; string output; if (startTime == 0.0) { output = StringBuilderCache.Format("{0} 00:00:00", prefix); } else { output = StringBuilderCache.Format("{0} {1}", prefix, DurationUtil.StringValue(end - startTime, true, (endTime != 0.0))); } return(output); }
protected override string GetParameterTitle() { double end = endTime == 0.0 ? Planetarium.GetUniversalTime() : endTime; string prefix = string.IsNullOrEmpty(title) ? "Mission Timer:" : title; string output; if (startTime == 0.0) { output = prefix + " 00:00:00"; } else { output = prefix + " " + DurationUtil.StringValue(end - startTime, true, (endTime != 0.0)); } return(output); }
protected override string GetTitle() { if (state == ParameterState.Failed) { return("Time expired!"); } else if (endTime > 0.01) { string title = "Time remaining: " + DurationUtil.StringValue(endTime - Planetarium.GetUniversalTime()); // Add the string that we returned to the titleTracker. This is used to update // the contract title element in the GUI directly, as it does not support dynamic // text. titleTracker.Add(title); return(title); } else { return("Time limit: " + DurationUtil.StringValue(duration)); } }
protected override void OnUpdate() { if (waiting && Planetarium.GetUniversalTime() > completionTime) { SetState(ParameterState.Complete); if (state == ParameterState.Complete) { waiting = false; } } // Every time the clock ticks over, make an attempt to update the contract window // notes. We do this because otherwise the window will only ever read the notes once, // so this is the only way to get our fancy timer to work. else if (waiting && trackedVessel != null) { if (Planetarium.GetUniversalTime() - lastUpdate > 1.0f) { lastUpdate = Planetarium.GetUniversalTime(); // Force a call to GetTitle to update the contracts app GetTitle(); if (durationParameter != null) { durationParameter.SetTitle("Time Remaining: " + DurationUtil.StringValue(completionTime - Planetarium.GetUniversalTime())); } } } else { if (durationParameter != null) { durationParameter.SetTitle("Duration: " + DurationUtil.StringValue(duration)); } } }
protected void CreateDelegates() { // Filter for celestial bodies if (targetBody != null) { AddParameter(new ParameterDelegate <Vessel>("Destination: " + targetBody.CleanDisplayName(), v => v.mainBody == targetBody, true)); } // Filter for situation if (orbit == null) { AddParameter(new ParameterDelegate <Vessel>("Situation: " + ReachSituation.GetTitleStringShort(situation), v => v.situation == situation, true)); } // Filter for altitude if (minAltitude != 0.0 || maxAltitude != double.MaxValue) { string output = "Altitude: "; if (minAltitude == 0.0) { output += "Below " + maxAltitude.ToString("N0") + " m"; } else if (maxAltitude == double.MaxValue) { output += "Above " + minAltitude.ToString("N0") + " m"; } else { output += "Between " + minAltitude.ToString("N0") + " m and " + maxAltitude.ToString("N0") + " m"; } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.PeA >= minAltitude && v.orbit.ApA <= maxAltitude)); } // Filter for apoapsis if (minApoapsis != 0.0 || maxApoapsis != double.MaxValue) { string output = "Apoapsis: "; if (minApoapsis == 0.0) { output += "Below " + maxApoapsis.ToString("N0") + " m"; } else if (maxApoapsis == double.MaxValue) { output += "Above " + minApoapsis.ToString("N0") + " m"; } else { output += "Between " + minApoapsis.ToString("N0") + " m and " + maxApoapsis.ToString("N0") + " m"; } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.ApA >= minApoapsis && v.orbit.ApA <= maxApoapsis)); } // Filter for periapsis if (minPeriapsis != 0.0 || maxPeriapsis != double.MaxValue) { string output = "Periapsis: "; if (minPeriapsis == 0.0) { output += "Below " + maxPeriapsis.ToString("N0") + " m"; } else if (maxPeriapsis == double.MaxValue) { output += "Above " + minPeriapsis.ToString("N0") + " m"; } else { output += "Between " + minPeriapsis.ToString("N0") + " m and " + maxPeriapsis.ToString("N0") + " m"; } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.PeA >= minPeriapsis && v.orbit.PeA <= maxPeriapsis)); } // Filter for eccentricity if (minEccentricity != 0.0 || maxEccentricity != double.MaxValue) { string output = "Eccentricity: "; if (minEccentricity == 0.0) { output += "Below " + maxEccentricity.ToString("F4"); } else if (maxEccentricity == double.MaxValue) { output += "Above " + minEccentricity.ToString("F4"); } else { output += "Between " + minEccentricity.ToString("F4") + " and " + maxEccentricity.ToString("F4"); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.eccentricity >= minEccentricity && v.orbit.eccentricity <= maxEccentricity)); } // Filter for inclination if (minInclination != 0.0 || maxInclination != 180.0) { string output = "Inclination: "; if (minInclination == 0.0) { output += "Below " + maxInclination.ToString("F1") + "°"; } else if (maxInclination == 180.0) { output += "Above " + minInclination.ToString("F1") + "°"; } else { output += "Between " + minInclination.ToString("F1") + "° and " + maxInclination.ToString("F1") + "°"; } AddParameter(new ParameterDelegate <Vessel>(output, CheckInclination)); } // Filter for argument of periapsis if (minArgumentOfPeriapsis != 0.0 || !(Mathf.Approximately((float)maxArgumentOfPeriapsis, 360.0f) || Mathf.Approximately((float)maxArgumentOfPeriapsis, 0.0f))) { string output = "Argument of Periapsis: Between " + minArgumentOfPeriapsis.ToString("F1") + "° and " + maxArgumentOfPeriapsis.ToString("F1") + "°"; AddParameter(new ParameterDelegate <Vessel>(output, CheckAoP)); } // Filter for orbital period if (minPeriod != 0.0 || maxPeriod != double.MaxValue) { string output = "Period: "; if (minPeriod == 0.0) { output += "Below " + DurationUtil.StringValue(maxPeriod, false); } else if (maxPeriod == double.MaxValue) { output += "Above " + DurationUtil.StringValue(minPeriod, false); } else { output += "Between " + DurationUtil.StringValue(minPeriod, false) + " and " + DurationUtil.StringValue(maxPeriod, false); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.period >= minPeriod && v.orbit.period <= maxPeriod)); } // Filter for specific orbit if (orbit != null) { string output = "Reach the specified orbit"; AddParameter(new ParameterDelegate <Vessel>(output, v => VesselUtilities.VesselAtOrbit(orbit, deviationWindow, v))); } }
protected override string GetTitle() { string result = ""; double now = Planetarium.GetUniversalTime(); string remainingStr = durationType == DurationType.countdown ? DurationUtil.StringValue(Math.Max(0, doneAfter - now)) : DurationUtil.StringValue(Math.Max(0, duration - accumulatedDuration)); switch (durationState) { case DurationState.off: result = Localizer.Format("Duration: <<1>>", DurationUtil.StringValue(duration)); if (waitDuration > 0) { result += "\n\t - " + Localizer.Format("Time starts <<1>> after accepting the contract", Lib.Color(DurationUtil.StringValue(waitDuration), Lib.Kolor.Yellow)); } if (allowedDowntime > 0) { result += "\n\t - " + Localizer.Format("Allows interruptions up to <<1>>", DurationUtil.StringValue(allowedDowntime)); } else { result += "\n\t - " + "Does not allow interruptions"; } if (!allowReset) { result += "\n\t - " + Lib.Color("Will fail if interrupted beyond allowance", Lib.Kolor.Orange); } break; case DurationState.preRun: result = Localizer.Format("Duration: <<1>>", DurationUtil.StringValue(duration)); result += "\n\t - " + Localizer.Format("Time starts in <<1>>", Lib.Color(DurationUtil.StringValue(Math.Max(0, startAfter - now)), Lib.Kolor.Yellow)); if (allowedDowntime > 0) { result += "\n\t - " + Localizer.Format("Allows interruptions up to <<1>>", DurationUtil.StringValue(allowedDowntime)); } break; case DurationState.running: result = Localizer.Format("Remaining: <<1>>", Lib.Color(remainingStr, Lib.Kolor.Green)); if (allowedDowntime > 0) { result += "\n\t - " + Localizer.Format("Allows interruptions up to <<1>>", DurationUtil.StringValue(allowedDowntime)); } break; case DurationState.preReset: result = Localizer.Format("Remaining: <<1>> (stop in: <<2>>)", Lib.Color(remainingStr, Lib.Kolor.Green), Lib.Color(DurationUtil.StringValue(Math.Max(0, failAfter - now)), allowReset ? Lib.Kolor.Yellow : Lib.Kolor.Red)); break; case DurationState.done: result = "Done!"; break; case DurationState.failed: result = "Time is up!"; break; } titleTracker.Add(result); if (lastTitle != result && Root != null && (Root.ContractState == Contract.State.Active || Root.ContractState == Contract.State.Failed)) { titleTracker.UpdateContractWindow(result); lastTitle = result; } return(result); }
protected void CreateDelegates() { // Filter for celestial bodies if (targetBody != null) { AddParameter(new ParameterDelegate <Vessel>("Destination: " + targetBody.PrintName(), v => v.mainBody == targetBody, true)); } // Filter for situation AddParameter(new ParameterDelegate <Vessel>("Situation: Orbiting", v => v.situation == Vessel.Situations.ORBITING, true)); // Filter for altitude if (minAltitude != 0.0 || maxAltitude != double.MaxValue) { string output = "Altitude: "; if (minAltitude == 0.0) { output += "Below " + maxAltitude.ToString("N0") + " m"; } else if (maxAltitude == double.MaxValue) { output += "Above " + minAltitude.ToString("N0") + " m"; } else { output += "Between " + minAltitude.ToString("N0") + " m and " + maxAltitude.ToString("N0") + " m"; } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.PeA >= minAltitude && v.orbit.ApA <= maxAltitude)); } // Filter for apoapsis if (minApoapsis != 0.0 || maxApoapsis != double.MaxValue) { string output = "Apoapsis: "; if (minApoapsis == 0.0) { output += "Below " + maxApoapsis.ToString("N0") + " m"; } else if (maxApoapsis == double.MaxValue) { output += "Above " + minApoapsis.ToString("N0") + " m"; } else { output += "Between " + minApoapsis.ToString("N0") + " m and " + maxApoapsis.ToString("N0") + " m"; } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.ApA >= minApoapsis && v.orbit.ApA <= maxApoapsis)); } // Filter for periapsis if (minPeriapsis != 0.0 || maxPeriapsis != double.MaxValue) { string output = "Periapsis: "; if (minPeriapsis == 0.0) { output += "Below " + maxPeriapsis.ToString("N0") + " m"; } else if (maxPeriapsis == double.MaxValue) { output += "Above " + minPeriapsis.ToString("N0") + " m"; } else { output += "Between " + minPeriapsis.ToString("N0") + " m and " + maxPeriapsis.ToString("N0") + " m"; } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.PeA >= minPeriapsis && v.orbit.PeA <= maxPeriapsis)); } // Filter for eccentricity if (minEccentricity != 0.0 || maxEccentricity != double.MaxValue) { string output = "Eccentricity: "; if (minEccentricity == 0.0) { output += "Below " + maxEccentricity.ToString("F4"); } else if (maxEccentricity == double.MaxValue) { output += "Above " + minEccentricity.ToString("F4"); } else { output += "Between " + minEccentricity.ToString("F4") + " and " + maxEccentricity.ToString("F4"); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.eccentricity >= minEccentricity && v.orbit.eccentricity <= maxEccentricity)); } // Filter for inclination if (minInclination != 0.0 || maxInclination != 180.0) { string output = "Inclination: "; if (minInclination == 0.0) { output += "Below " + maxInclination.ToString("F1") + "°"; } else if (maxInclination == 180.0) { output += "Above " + minInclination.ToString("F1") + "°"; } else { output += "Between " + minInclination.ToString("F1") + "° and " + maxInclination.ToString("F1") + "°"; } AddParameter(new ParameterDelegate <Vessel>(output, CheckInclination)); } // Filter for orbital period if (minPeriod != 0.0 || maxPeriod != double.MaxValue) { string output = "Period: "; if (minPeriod == 0.0) { output += "Below " + DurationUtil.StringValue(maxPeriod, false); } else if (maxPeriod == double.MaxValue) { output += "Above " + DurationUtil.StringValue(minPeriod, false); } else { output += "Between " + DurationUtil.StringValue(minPeriod, false) + " and " + DurationUtil.StringValue(maxPeriod, false); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.period >= minPeriod && v.orbit.period <= maxPeriod)); } }
protected override string GetTitle() { InitStrings(); string result = ""; double now = Planetarium.GetUniversalTime(); string remainingStr = durationType == DurationType.countdown ? DurationUtil.StringValue(Math.Max(0, doneAfter - now)) : DurationUtil.StringValue(Math.Max(0, duration - accumulatedDuration)); switch (durationState) { case DurationState.off: result = KerCon_Duration_X; // Duration: <<1>> if (waitDuration > 0) { result += "\n\t - " + KerCon_TimeStartsAfterAccepting; } if (allowedDowntime > 0) { result += "\n\t - " + KerCon_AllowsInterruptionsUpTo; } else if (durationType == DurationType.accumulating) { result += "\n\t - " + KerCon_AccumulatingDuration; } else { result += "\n\t - " + KerCon_DoesNotAllowInterruptions; // Does not allow interruptions } if (!allowReset) { result += "\n\t - " + KerCon_WillFailIfInterrupted; // Will fail if interrupted beyond allowance } break; case DurationState.preRun: result = KerCon_Duration_X; // Duration: <<1>> result += "\n\t - " + Localizer.Format("#KerCon_TimeStartsIn", // Time starts in <<1>> Lib.Color(DurationUtil.StringValue(Math.Max(0, startAfter - now)), Lib.Kolor.Yellow)); if (allowedDowntime > 0) { result += "\n\t - " + KerCon_AllowsInterruptionsUpTo; } break; case DurationState.running: result = Localizer.Format("#KerCon_Reamining_X", Lib.Color(remainingStr, Lib.Kolor.Green)); // Remaining: <<1>> //if (allowedDowntime > 0) // result += "\n\t - " + Localizer.Format("#KerCon_AllowsInterruptionsUpTo", // Allows interruptions up to <<1>> // DurationUtil.StringValue(allowedDowntime)); break; case DurationState.preReset: result = Localizer.Format("#KerCon_Reamining_X_stopIn_Y", Lib.Color(remainingStr, Lib.Kolor.Green), // Remaining: <<1>> (stop in: <<2>>) Lib.Color(DurationUtil.StringValue(Math.Max(0, failAfter - now)), allowReset ? Lib.Kolor.Yellow : Lib.Kolor.Red)); break; case DurationState.done: result = "#autoLOC_135144"; // Success!! break; case DurationState.failed: result = "#KerCon_TimeIsUp"; // Time is up! break; } if (result.StartsWith("#")) { result = Localizer.Format(result); } titleTracker.Add(result); if (lastTitle != result && Root != null && (Root.ContractState == Contract.State.Active || Root.ContractState == Contract.State.Failed)) { titleTracker.UpdateContractWindow(result); lastTitle = result; } return(result); }
protected override string GetParameterTitle() { Vessel currentVessel = CurrentVessel(); string title = null; if (currentVessel != null && endTimes.ContainsKey(currentVessel.id) && endTimes[currentVessel.id] > 0.01 || currentVessel == null && endTime > 0.01) { double time = currentVessel != null ? endTimes[currentVessel.id] : endTime; if (time - Planetarium.GetUniversalTime() > 0.0) { // Time to completion: title = StringBuilderCache.Format("{0} {1}", (waitingText ?? Localizer.GetStringByTag("#cc.param.Duration.waiting")), DurationUtil.StringValue(time - Planetarium.GetUniversalTime())); } else { // Wait time over title = completionText ?? Localizer.GetStringByTag("#cc.param.Duration.completion"); } } else { // Waiting time required: title = StringBuilderCache.Format("{0} {1}", (preWaitText ?? Localizer.GetStringByTag("#cc.param.Duration.preWait")), DurationUtil.StringValue(duration)); } return(title); }
protected override string GetTitle() { // Set the first part of the output string output; if (!string.IsNullOrEmpty(title)) { output = title; } else { // Set the vessel name output = "Vessel: "; if ((waiting || state == ParameterState.Complete) && trackedVessel != null) { output += trackedVessel.vesselName; } else if (!string.IsNullOrEmpty(define)) { output += define + " (new)"; } else if (vesselList.Any()) { bool first = true; foreach (string vesselName in vesselList) { if (!first) { output += " OR "; } if (ContractVesselTracker.Instance != null) { output += ContractVesselTracker.Instance.GetDisplayName(vesselName); } else { LoggingUtil.LogWarning(this, "Unable to get vessel display name for '" + vesselName + "' - ContractVesselTracker is null. This is likely caused by another ScenarioModule crashing, preventing others from loading."); output += vesselName; } first = false; } } else { output += "Any"; } } // Not yet complete, add duration if (state != ParameterState.Complete) { // Add duration if (completionTime > 0.0) { output += "; Time Remaining: " + DurationUtil.StringValue(completionTime - Planetarium.GetUniversalTime()); } else if (duration > 0.0) { output += "; Duration: " + DurationUtil.StringValue(duration); } } // If we're complete and a custom title hasn't been provided, try to get a better title else if (string.IsNullOrEmpty(title)) { if (ParameterCount == 1) { output = ""; if (trackedVessel != null) { output += "Vessel: " + trackedVessel.vesselName + ": "; } output += GetParameter(0).Title; } } // Add the string that we returned to the titleTracker. This is used to update // the contract title element in the GUI directly, as it does not support dynamic // text. titleTracker.Add(output); return(output); }
protected void CreateDelegates() { // Filter for celestial bodies if (targetBody != null) { AddParameter(new ParameterDelegate <Vessel>(Localizer.Format("#cc.param.CollectScience.destination", targetBody.displayName), v => v.mainBody == targetBody, true)); } // Filter for situation if (orbit == null) { AddParameter(new ParameterDelegate <Vessel>(Localizer.Format("#cc.param.CollectScience.situation", ReachSituation.GetTitleStringShort(situation)), v => v.situation == situation, true)); } // Filter for altitude if (minAltitude != 0.0 || maxAltitude != double.MaxValue) { string output; if (minAltitude == 0.0) { output = Localizer.Format("#cc.param.Orbit.below.meters", Localizer.GetStringByTag("#cc.altitude"), maxAltitude.ToString("N0")); } else if (maxAltitude == double.MaxValue) { output = Localizer.Format("#cc.param.Orbit.above.meters", Localizer.GetStringByTag("#cc.altitude"), minAltitude.ToString("N0")); } else { output = Localizer.Format("#cc.param.Orbit.between.meters", Localizer.GetStringByTag("#cc.altitude"), minAltitude.ToString("N0"), maxAltitude.ToString("N0")); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.PeA >= minAltitude && v.orbit.ApA <= maxAltitude)); } // Filter for apoapsis if (minApoapsis != 0.0 || maxApoapsis != double.MaxValue) { string output; if (minApoapsis == 0.0) { output = Localizer.Format("#cc.param.Orbit.below.meters", Localizer.GetStringByTag("#cc.apoapsis"), maxApoapsis.ToString("N0")); } else if (maxApoapsis == double.MaxValue) { output = Localizer.Format("#cc.param.Orbit.above.meters", Localizer.GetStringByTag("#cc.apoapsis"), minApoapsis.ToString("N0")); } else { output = Localizer.Format("#cc.param.Orbit.between.meters", Localizer.GetStringByTag("#cc.apoapsis"), minApoapsis.ToString("N0"), maxApoapsis.ToString("N0")); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.ApA >= minApoapsis && v.orbit.ApA <= maxApoapsis)); } // Filter for periapsis if (minPeriapsis != 0.0 || maxPeriapsis != double.MaxValue) { string output; if (minPeriapsis == 0.0) { output = Localizer.Format("#cc.param.Orbit.below.meters", Localizer.GetStringByTag("#cc.periapsis"), maxPeriapsis.ToString("N0")); } else if (maxPeriapsis == double.MaxValue) { output = Localizer.Format("#cc.param.Orbit.above.meters", Localizer.GetStringByTag("#cc.periapsis"), minPeriapsis.ToString("N0")); } else { output = Localizer.Format("#cc.param.Orbit.between.meters", Localizer.GetStringByTag("#cc.periapsis"), minPeriapsis.ToString("N0"), maxPeriapsis.ToString("N0")); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.PeA >= minPeriapsis && v.orbit.PeA <= maxPeriapsis)); } // Filter for eccentricity if (minEccentricity != 0.0 || maxEccentricity != double.MaxValue) { string output; if (minEccentricity == 0.0) { output = Localizer.Format("#cc.param.Orbit.below.nounits", Localizer.GetStringByTag("#cc.eccentricity"), maxEccentricity.ToString("F4")); } else if (maxEccentricity == double.MaxValue) { output = Localizer.Format("#cc.param.Orbit.above.nounits", Localizer.GetStringByTag("#cc.eccentricity"), minEccentricity.ToString("F4")); } else { output = Localizer.Format("#cc.param.Orbit.between.nounits", Localizer.GetStringByTag("#cc.eccentricity"), minEccentricity.ToString("F4"), maxEccentricity.ToString("F4")); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.eccentricity >= minEccentricity && v.orbit.eccentricity <= maxEccentricity)); } // Filter for inclination if (minInclination != 0.0 || maxInclination != 180.0) { string output; if (minInclination == 0.0) { output = Localizer.Format("#cc.param.Orbit.below.degrees", Localizer.GetStringByTag("#cc.inclination"), maxInclination.ToString("F1")); } else if (maxInclination == 180.0) { output = Localizer.Format("#cc.param.Orbit.above.degrees", Localizer.GetStringByTag("#cc.inclination"), minInclination.ToString("F1")); } else { output = Localizer.Format("#cc.param.Orbit.between.degrees", Localizer.GetStringByTag("#cc.inclination"), minInclination.ToString("F1"), maxInclination.ToString("F1")); } AddParameter(new ParameterDelegate <Vessel>(output, CheckInclination)); } // Filter for argument of periapsis if (minArgumentOfPeriapsis != 0.0 || !(Mathf.Approximately((float)maxArgumentOfPeriapsis, 360.0f) || Mathf.Approximately((float)maxArgumentOfPeriapsis, 0.0f))) { string output = Localizer.Format("#cc.param.Orbit.between.degrees", Localizer.GetStringByTag("#autoLOC_6005020"), minArgumentOfPeriapsis.ToString("F1"), maxArgumentOfPeriapsis.ToString("F1")); AddParameter(new ParameterDelegate <Vessel>(output, CheckAoP)); } // Filter for orbital period if (minPeriod != 0.0 || maxPeriod != double.MaxValue) { string output; if (minPeriod == 0.0) { output = Localizer.Format("#cc.param.Orbit.below.nounits", Localizer.GetStringByTag("#autoLOC_6005032"), DurationUtil.StringValue(maxPeriod, false)); } else if (maxPeriod == double.MaxValue) { output = Localizer.Format("#cc.param.Orbit.above.nounits", Localizer.GetStringByTag("#autoLOC_6005032"), DurationUtil.StringValue(minPeriod, false)); } else { output = Localizer.Format("#cc.param.Orbit.between.nounits", Localizer.GetStringByTag("#autoLOC_6005032"), DurationUtil.StringValue(minPeriod, false), DurationUtil.StringValue(maxPeriod, false)); } AddParameter(new ParameterDelegate <Vessel>(output, v => v.orbit.period >= minPeriod && v.orbit.period <= maxPeriod)); } // Filter for specific orbit if (orbit != null) { AddParameter(new ParameterDelegate <Vessel>(Localizer.GetStringByTag("#cc.param.Orbit.specified"), v => VesselUtilities.VesselAtOrbit(orbit, deviationWindow, v))); } }