private void OnRecovered(ProtoVessel pv, bool dummy) { CelestialBody targetBody = StnSciParameter.getTargetBody(this); AvailablePart experimentType = StnSciParameter.getExperimentType(this); if (targetBody == null || experimentType == null) { return; } foreach (ProtoPartSnapshot part in pv.protoPartSnapshots) { if (part.partName == experimentType.name) { foreach (ProtoPartModuleSnapshot module in part.modules) { if (module.moduleName == "StationExperiment") { ConfigNode cn = module.moduleValues; if (!cn.HasValue("launched") || !cn.HasValue("completed")) { continue; } float launched, completed; try { launched = float.Parse(cn.GetValue("launched")); completed = float.Parse(cn.GetValue("completed")); } catch (Exception e) { StnSciScenario.LogError(e.ToString()); continue; } if (launched >= this.Root.DateAccepted && completed >= launched) { foreach (ConfigNode datum in cn.GetNodes("ScienceData")) { if (!datum.HasValue("subjectID")) { continue; } string subjectID = datum.GetValue("subjectID"); if (subjectID.ToLower().Contains("@" + targetBody.name.ToLower() + "inspace")) { StnSciParameter parent = this.Parent as StnSciParameter; SetComplete(); if (parent != null) { parent.Complete(); } return; } } } } } } } }
private void OnRecovery(Vessel vessel) { Debug.Log("Recovering " + vessel.vesselName); CelestialBody targetBody = StnSciParameter.getTargetBody(this); AvailablePart experimentType = StnSciParameter.getExperimentType(this); if (targetBody == null || experimentType == null) { Debug.Log("targetBody or experimentType is null"); return; } foreach (Part part in vessel.Parts) { if (part.name == experimentType.name) { StationExperiment e = part.FindModuleImplementing <StationExperiment>(); if (e != null) { if (e.launched >= this.Root.DateAccepted && e.completed >= e.launched) { ScienceData[] data = e.GetData(); foreach (ScienceData datum in data) { if (datum.subjectID.ToLower().Contains("@" + targetBody.name.ToLower() + "inspace")) { StnSciParameter parent = this.Parent as StnSciParameter; SetComplete(); if (parent != null) { parent.Complete(); } return; } } } } } } SetIncomplete(); }