Exemplo n.º 1
0
        /// <summary>
        /// Cache ModuleScienceExperiments so we don't have to waste time
        /// looking for them later.  Any time the vessel has changed (modified,
        /// lost a part like mystery goo can, etc), this function should be
        /// called to keep the modules up to date.
        /// </summary>
        public virtual void Rescan()
        {
            Log.Debug("ExperimentObserver.Rescan - {0}", experiment.id);

            modules = new ScienceModuleList();

            if (FlightGlobals.ActiveVessel == null)
            {
                return;
            }

            // locate all ModuleScienceExperiments that implement this
            // experiment.  By keeping track of them ourselves, we don't
            // need to bother ScienceAlert with any details of
            // the inner workings of this object
            ScienceModuleList potentials = FlightGlobals.ActiveVessel.FindPartModulesImplementing <ModuleScienceExperiment>();

            foreach (var potential in potentials)
            {
                if (potential.experimentID == experiment.id)
                {
                    modules.Add(potential);
                }
            }

            Log.Debug("Rebuilt ExperimentObserver for experiment {0} (active vessel has {1} experiments of type)", experiment.id, modules.Count);
        }
Exemplo n.º 2
0
        public virtual void Rescan()
        {
            modules = new ScienceModuleList();
            if (FlightGlobals.ActiveVessel == null)
            {
                return;
            }

            ScienceModuleList potentials = FlightGlobals.ActiveVessel
                                           .FindPartModulesImplementing <ModuleScienceExperiment>();

            foreach (var potential in potentials)
            {
                if (potential.experimentID == experiment.id)
                {
                    modules.Add(potential);
                }
            }
        }
Exemplo n.º 3
0
        public virtual void Rescan()
        {
            modules = new ScienceModuleList();
            if (FlightGlobals.ActiveVessel == null)
            {
                return;
            }

            ScienceModuleList potentials = FlightGlobals.ActiveVessel
                                           .FindPartModulesImplementing <ModuleScienceExperiment>();

            for (int i = potentials.Count - 1; i >= 0; i--)
            {
                ModuleScienceExperiment potential = potentials[i];
                if (potential.experimentID == experiment.id && !ExcludeFilters.IsExcluded(potential))
                {
                    modules.Add(potential);
                }
            }
        }