public Notes_DataObject(ScienceData d, Notes_DataPart r, IScienceDataContainer c) { data = d; root = r; container = c; sub = ResearchAndDevelopment.GetSubjectByID(d.subjectID); if (sub != null) { returnValue = ResearchAndDevelopment.GetScienceValue(data.dataAmount, sub, 1f) * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier; transmitValue = ResearchAndDevelopment.GetScienceValue(data.dataAmount, sub, data.transmitValue) * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier; remainingValue = Math.Min(sub.scienceCap, Math.Max(0f, sub.scienceCap * sub.scientificValue)) * HighLogic.CurrentGame.Parameters.Career.ScienceGainMultiplier; text = ResearchAndDevelopment.GetResults(sub.id); } title = d.title; }
protected override void updateValidParts() { if (archived) return; if (validParts.Count <= 0) return; for (int i = 0; i < validParts.Count; i++) { Part p = validParts[i]; if (p == null) continue; Notes_DataPart n = getNotesData(p.flightID); if (n == null) n = new Notes_DataPart(p, this); n.clearData(); for (int k = 0; k < p.FindModulesImplementing<IScienceDataContainer>().Count; k++) { IScienceDataContainer container = p.FindModulesImplementing<IScienceDataContainer>()[k]; if (container == null) continue; for (int j = 0; j < container.GetScienceCount(); j++) { ScienceData d = container.GetData()[j]; if (d == null) continue; n.addPartData(d, container); } } if (n.DataCount > 0) { if (!allData.ContainsKey(p.flightID)) allData.Add(p.flightID, n); } else if (allData.ContainsKey(p.flightID)) allData.Remove(p.flightID); } }