// analyze a sample static void analyze(Vessel v, string filename, double amount) { // get vessel drive Drive drive = DB.Vessel(v).drive; // get sample Sample sample = drive.samples[filename]; // analyze, and produce data amount = Math.Min(amount, sample.size); bool completed = amount >= sample.size - double.Epsilon; drive.delete_sample(filename, amount); drive.record_file(filename, amount); // if the analysis is completed if (completed) { // inform the user Message.Post ( Lib.BuildString("<color=cyan><b>ANALYSIS COMPLETED</b></color>\nOur laboratory on <b>", v.vesselName, "</b> analyzed <b>", Science.experiment(filename).name, "</b>"), "The results can be transmitted now" ); // record landmark event if (!Lib.Landed(v)) { DB.landmarks.space_analysis = true; } } }
// remove a sample from a vessel public static void RemoveSample(Vessel v, string subject_id, double amount) { if (!Cache.VesselInfo(v).is_valid) { return; } Drive drive = DB.Vessel(v).drive; drive.delete_sample(subject_id, amount); }
public void DumpData(ScienceData data) { // get drive Drive drive = DB.Vessel(vessel).drive; // if not the preferred drive if (drive.location != part.flightID) { return; } // remove the data if (data.baseTransmitValue > float.Epsilon || data.transmitBonus > double.Epsilon) { drive.delete_file(data.subjectID, data.dataAmount); } else { drive.delete_sample(data.subjectID, data.dataAmount); } }