private void LoadScienceExperiments() { experiments.Clear(); foreach (ModuleScienceExperiment experiment in vessel.FindPartModulesImplementing <ModuleScienceExperiment>()) { ScienceAIExperiment modExperiment = new ScienceAIExperiment(experiment); experiments.Add(modExperiment); } experiments.Add(new ScienceAIExperiment("evaReport")); experiments.Add(new ScienceAIExperiment("surfaceSample")); }
private void RunExperiment(ScienceAIExperiment experiment, ExperimentSituations situation, ScienceAIVesselModule mod, Vessel v, String biome) { String currentBiome = String.Empty; ScienceExperiment exp = ResearchAndDevelopment.GetExperiment(experiment.experimentID); if (exp.BiomeIsRelevantWhile(situation)) { currentBiome = v.landedAt != string.Empty ? v.landedAt : biome; } ScienceSubject subj = ResearchAndDevelopment.GetExperimentSubject(exp, situation, v.mainBody, currentBiome, null); if (((subj.scienceCap - subj.science) > 0.1 || mod.collectEmpty) && mod.results.Find(r => r.subjectID == subj.id) == null) { ScienceAIData result = new ScienceAIData(exp.baseValue * exp.dataScale, experiment.xmitDataScalar, 0f, subj.id, subj.title); mod.results.Add(result); if (experiment.rerunnable == false) { experiment.inoperable = true; } } }
private bool ValidateExperiment(ScienceAIExperiment experiment, ExperimentSituations situation, ScienceAIVesselModule mod, Vessel v) { float ACLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.AstronautComplex); float RnDLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.ResearchAndDevelopment); if (experiment.rerunnable == false && mod.reusableOnly) { return(false); } bool hasCrew = v.GetVesselCrew().Count() > 0; bool hasScientist = v.GetVesselCrew().FindAll(pcm => pcm.trait == "Scientist").Count() > 0; bool evaPossible = false; double altitude = (v.GetWorldPos3D() - v.mainBody.position).magnitude - v.mainBody.Radius; if (hasCrew) { if (!v.mainBody.atmosphere && ACLevel >= 0.5) { evaPossible = true; } else if (altitude > v.mainBody.atmosphereDepth && ACLevel >= 0.5) { evaPossible = true; } else if (situation == ExperimentSituations.SrfLanded || situation == ExperimentSituations.SrfSplashed) { evaPossible = true; } } if (experiment.experimentID == "evaReport") { if (!evaPossible) { return(false); } } if (experiment.experimentID == "surfaceSample") { if (situation != ExperimentSituations.SrfLanded && situation != ExperimentSituations.SrfSplashed) { return(false); } if (RnDLevel < 0.5) { return(false); } } if (experiment.inoperable == true && hasScientist && evaPossible) { experiment.inoperable = false; } if (experiment.inoperable) { return(false); } return(true); }