private static void UpdateResearchedFilter() { researchedExpInfos.Clear(); ExperimentInfo alwaysResearchedExperiment; foreach (string experimentId in alwaysResearchedExperiments) { alwaysResearchedExperiment = ScienceDB.GetExperimentInfo(experimentId); if (alwaysResearchedExperiment != null) { researchedExpInfos.Add(alwaysResearchedExperiment); } } foreach (AvailablePart availablePart in PartLoader.LoadedPartsList) { // EVA kerbals have no tech required if (!string.IsNullOrEmpty(availablePart.TechRequired) && !ResearchAndDevelopment.PartModelPurchased(availablePart)) { continue; } List <Experiment> configureResearchedExperiments = new List <Experiment>(); foreach (PartModule partModule in availablePart.partPrefab.Modules) { if (partModule is Configure configure) { foreach (ConfigureSetup setup in configure.GetUnlockedSetups()) { foreach (ConfigureModule configureModule in setup.modules) { if (configureModule.type == "Experiment") { PartModule configuredModule = configure.Find_module(configureModule); if (configuredModule != null && configuredModule is Experiment configureExperiment) { configureResearchedExperiments.Add(configureExperiment); } } } } } } foreach (PartModule partModule in availablePart.partPrefab.Modules) { if (partModule is Experiment experiment) { if (researchedExpInfos.Contains(experiment.ExpInfo)) { continue; } bool isResearched = false; if (configureResearchedExperiments.Count > 0) { if (configureResearchedExperiments.Contains(experiment)) { isResearched = true; } } else { isResearched = true; } if (isResearched && experiment.Requirements.TestProgressionRequirements()) { researchedExpInfos.Add(experiment.ExpInfo); } } else if (partModule is ModuleScienceExperiment stockExperiment) { ExperimentInfo expInfo = ScienceDB.GetExperimentInfo(stockExperiment.experimentID); if (expInfo != null) { researchedExpInfos.Add(expInfo); } } else if (partModule is ModuleGroundExperiment groundExp) { ExperimentInfo expInfo = ScienceDB.GetExperimentInfo(groundExp.experimentId); if (expInfo != null) { researchedExpInfos.Add(expInfo); } } } } // ROCs are always researched foreach (ExperimentInfo experimentInfo in ScienceDB.ExperimentInfos) { if (experimentInfo.IsROC) { researchedExpInfos.Add(experimentInfo); } } }
private static void UpdateVesselFilter() { vesselExpInfos.Clear(); bool hasROCScience = false; foreach (Part part in vesselParts) { foreach (PartModule partModule in part.Modules) { if (!partModule.enabled || !partModule.isEnabled) { continue; } if (partModule is Experiment experiment) { vesselExpInfos.Add(experiment.ExpInfo); } else if (partModule is ModuleScienceExperiment stockExperiment) { if (stockExperiment.experimentID == "ROCScience") { hasROCScience = true; } else { ExperimentInfo expInfo = ScienceDB.GetExperimentInfo(stockExperiment.experimentID); if (expInfo != null) { vesselExpInfos.Add(expInfo); } } } else if (partModule is ModuleInventoryPart inventory) { #pragma warning disable CS0618 // Type or member is obsolete foreach (string inventoryPartName in inventory.InventoryPartsList) #pragma warning restore CS0618 // Type or member is obsolete { Part groundPart = PartLoader.getPartInfoByName(inventoryPartName)?.partPrefab; if (groundPart == null) { continue; } foreach (PartModule groundmodule in groundPart.Modules) { if (groundmodule is ModuleGroundExperiment groundExp) { ExperimentInfo expInfo = ScienceDB.GetExperimentInfo(groundExp.experimentId); if (expInfo != null) { vesselExpInfos.Add(expInfo); } } } } } } } if (hasROCScience) { foreach (ExperimentInfo experimentInfo in ScienceDB.ExperimentInfos) { if (experimentInfo.IsROC) { vesselExpInfos.Add(experimentInfo); } } } }
public ExpInfoAndSubjects(ExperimentInfo expInfo, ExperimentSubjectList experimentSubjectList) { this.expInfo = expInfo; this.experimentSubjectList = experimentSubjectList; }
// TODO: Implement support to CommNet frequency void Indicator_Signal(Panel p, Vessel v, Vessel_Info vi) { ConnectionInfo conn = vi.connection; // target name string target_str = string.Empty; switch (vi.connection.status) { case LinkStatus.direct_link: target_str = "DSN"; break; case LinkStatus.indirect_link: target_str = vi.connection.path[vi.connection.path.Count - 1].vesselName; break; default: target_str = "none"; break; } // transmitted label, content and tooltip string comms_label = vi.relaying.Length == 0 ? "transmitting" : "relaying"; string comms_str = vi.connection.linked ? "telemetry" : "nothing"; string comms_tooltip = string.Empty; if (vi.relaying.Length > 0) { ExperimentInfo exp = Science.Experiment(vi.relaying); comms_str = exp.name; comms_tooltip = exp.fullname; } else if (vi.transmitting.Length > 0) { ExperimentInfo exp = Science.Experiment(vi.transmitting); comms_str = exp.name; comms_tooltip = exp.fullname; } string tooltip = Lib.BuildString ( "<align=left />", "connected\t<b>", vi.connection.linked ? "yes" : "no", "</b>\n", "rate\t\t<b>", Lib.HumanReadableDataRate(vi.connection.rate), "</b>\n", "target\t\t<b>", target_str, "</b>\n", comms_label, "\t<b>", comms_str, "</b>" ); Texture image = Icons.signal_red; switch (conn.status) { case LinkStatus.direct_link: image = vi.connection.rate > 0.005 ? Icons.signal_white : Icons.signal_yellow; break; case LinkStatus.indirect_link: image = vi.connection.rate > 0.005 ? Icons.signal_white : Icons.signal_yellow; tooltip += "\n\n<color=yellow>Signal relayed</color>"; break; case LinkStatus.no_link: image = Icons.signal_red; break; case LinkStatus.no_antenna: image = Icons.signal_red; tooltip += "\n\n<color=red>No antenna</color>"; break; case LinkStatus.blackout: image = Icons.signal_red; tooltip += "\n\n<color=red>Blackout</color>"; break; } p.SetIcon(image, tooltip); }
public bool BiomeIsRelevant(ExperimentInfo experiment) { return((experiment.biomeMask & (int)sit) != 0); }