示例#1
0
        public override void OnStart(StartState state)
        {
            // don't break tutorial scenarios
            if (Lib.DisableScenario(this))
            {
                return;
            }

            if (hdId == 0)
            {
                hdId = part.flightID;
            }

            if (drive == null)
            {
                if (!Lib.IsFlight())
                {
                    drive = new Drive(title, dataCapacity, sampleCapacity);
                }
                else
                {
                    drive = DB.Drive(hdId, title, dataCapacity, sampleCapacity);
                }
            }

            if (vessel != null)
            {
                Cache.RemoveVesselObjectsCache(vessel, "drives");
            }

            drive.is_private |= experiment_id.Length > 0;
            UpdateCapacity();
        }
示例#2
0
        private static Drive GetDrive(Experiment experiment, Vessel vessel, uint hdId, double chunkSize, string subject_id)
        {
            bool  isFile = experiment.sample_mass < float.Epsilon;
            Drive drive  = null;

            if (hdId != 0)
            {
                drive = DB.Drive(hdId);
            }
            else
            {
                drive = isFile ? Drive.FileDrive(vessel, chunkSize) : Drive.SampleDrive(vessel, chunkSize, subject_id);
            }
            return(drive);
        }