コード例 #1
0
 public bool CanTransfer(ModuleScienceExperiment baseExperiment, IScienceDataContainer moduleScienceContainer)
 {
     if (baseExperiment.GetScienceCount() == 0)
     {
         Log(baseExperiment.experimentID, ": Experiment has no data skiping transfer ", baseExperiment.GetScienceCount());
         return(false);
     }
     if (!baseExperiment.IsRerunnable())
     {
         if (!_AutomatedScienceSamplerInstance.craftSettings.transferAllData)
         {
             Log(baseExperiment.experimentID, ": Experiment isn't rerunnable and transferAllData is turned off.");
             return(false);
         }
     }
     if (!_AutomatedScienceSamplerInstance.craftSettings.dumpDuplicates)
     {
         foreach (var data in baseExperiment.GetData())
         {
             if (moduleScienceContainer.HasData(data))
             {
                 Log(baseExperiment.experimentID, ": Target already has experiment and dumping is disabled.");
                 return(false);
             }
         }
     }
     Log(baseExperiment.experimentID, ": We can transfer the science!");
     return(true);
 }
コード例 #2
0
 private void PrepareInfoDescription(AvailablePart part, ModuleScienceExperiment moduleScienceExperiment, List <string> itemInfo)
 {
     try
     {
         List <AvailablePart.ModuleInfo> infos = part.moduleInfos;
         AvailablePart.ModuleInfo        d     = null;
         foreach (AvailablePart.ModuleInfo x in infos)
         {
             if (!x.info.Contains(moduleScienceExperiment.experimentActionName))
             {
                 continue;
             }
             d = x;
             break;
         }
         if (d == null)
         {
             return;
         }
         d.info = string.Concat(d.info, "\n", GetInfo(itemInfo, _usageMaskInt));
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
コード例 #3
0
        public ScienceSubject GetScienceSubject(ModuleScienceExperiment baseExperiment)
        {
            //experiment.BiomeIsRelevantWhile
            string biome = CurrentBiome(baseExperiment.experiment);

            return(ResearchAndDevelopment.GetExperimentSubject(baseExperiment.experiment, ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel), FlightGlobals.currentMainBody, biome, ScienceUtil.GetBiomedisplayName(FlightGlobals.currentMainBody, biome)));
        }
コード例 #4
0
        public bool CanRunExperiment(ModuleScienceExperiment baseExperiment, float currentScienceValue)
        {
            if (!baseExperiment.experiment.IsAvailableWhile(ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel), FlightGlobals.currentMainBody))//
            {
                _AutomatedScienceSamplerInstance.Log(baseExperiment.experimentID, ": Experiment isn't available in the current situation: ", ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel), "_", FlightGlobals.currentMainBody + "_", baseExperiment.experiment.situationMask);
                return(false);
            }
            if (baseExperiment.Inoperable)
            {
                _AutomatedScienceSamplerInstance.Log(baseExperiment.experimentID, ": Experiment is inoperable");
                return(false);
            }
            if (baseExperiment.Deployed)
            {
                _AutomatedScienceSamplerInstance.Log(baseExperiment.experimentID, ": Experiment is deployed");
                return(false);
            }

            if (!baseExperiment.rerunnable && !_AutomatedScienceSamplerInstance.craftSettings.oneTimeOnly)
            {
                _AutomatedScienceSamplerInstance.Log(baseExperiment.experimentID, ": Runing rerunable experiments is disabled");
                return(false);
            }
            if (currentScienceValue < _AutomatedScienceSamplerInstance.craftSettings.threshold)
            {
                _AutomatedScienceSamplerInstance.Log(baseExperiment.experimentID, ": Science value is less than cutoff threshold: ", currentScienceValue, "<", _AutomatedScienceSamplerInstance.craftSettings.threshold);
                return(false);
            }
            if (!baseExperiment.experiment.IsUnlocked())
            {
                _AutomatedScienceSamplerInstance.Log(baseExperiment.experimentID, ": Experiment is locked");
                return(false);
            }
            return(true);
        }
コード例 #5
0
        public void RunStandardModuleScienceExperiment(ModuleScienceExperiment exp)
        {
            if (exp.Inoperable)
            {
                return;
            }

            if (_parent.Config.ShowResultsWindow)
            {
                exp.DeployExperiment( );
            }
            else
            {
                if (!exp.useStaging)
                {
                    exp.useStaging = true;
                    exp.OnActive();
                    exp.useStaging = false;
                }
                else
                {
                    exp.OnActive();
                }
            }
        }
コード例 #6
0
        /** Updates experiments and other fields */
        private void StatusUpdate()
        {
            timeSince           = 0f;
            curVessel           = FlightGlobals.ActiveVessel;
            curBiome            = currentBiome();
            expSituation        = ScienceUtil.GetExperimentSituation(curVessel);
            lastBody            = curVessel.mainBody;
            experiments         = getExperiments();
            possExperiments     = new List <ModuleScienceExperiment>();
            finishedExperiments = new List <ModuleScienceExperiment>();
            IETExperiment activator;

            if (experiments.Count() > 0)
            {
                for (int i = experiments.Count - 1; i >= 0; i--)
                {
                    ModuleScienceExperiment exp = experiments[i];

                    activator = checkType(exp);
                    if (activator != null)
                    {
                        if (activator.hasData(exp))
                        {
                            finishedExperiments.Add(exp);
                        }
                        else if (activator.checkExperiment(exp, expSituation, lastBody, curBiome))
                        {
                            possExperiments.Add(exp);
                        }
                    }
                }
            }
        }
コード例 #7
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     if (HighLogic.LoadedSceneIsFlight)
     {
         brazo1 = part.FindModelTransform("arm_01 (1)").gameObject;
         brazo2 = part.FindModelTransform("arm_01 (2)").gameObject;
         brazo1.SetActive(true);
         brazo2.SetActive(false);
         foreach (var ciencia in part.FindModulesImplementing <ModuleScienceExperiment>())
         {
             if (ciencia.experimentID == "taladro")
             {
                 tala = ciencia;
             }
             if (ciencia.experimentID == "mobileMaterialsLab")
             {
                 pre = ciencia;
             }
         }
         foreach (var anim in part.FindModulesImplementing <ModuleAnimateGeneric>())
         {
             if (anim.moduleID == "tala")
             {
                 taladro = anim;
             }
             if (anim.moduleID == "pre")
             {
                 presion = anim;
             }
         }
     }
 }
コード例 #8
0
        internal bool RunExperiment(string sid, ModuleScienceExperiment exp, bool runSingleUse = true)
        {
            DMModuleScienceAnimate m = null;

            // If possible run with DMagic DMAPI

            IEnumerable <DMModuleScienceAnimate> lm2 = FlightGlobals.ActiveVessel.FindPartModulesImplementing <DMModuleScienceAnimate>().Where(x => inheritsFromOrIsDMModuleScienceAnimate(x) && x.experimentID == sid).ToList();

            if (lm2.Any())
            {
                m = lm2.FirstOrDefault(x =>
                {
                    return(!x.Inoperable &&
                           ((int)x.Fields.GetValue("experimentLimit") > 1 ? DMagic.DMAPI.experimentCanConduct(x) : DMagic.DMAPI.experimentCanConduct(x) &&
                            (x.rerunnable || runSingleUse)));
                });

                if (m != null)
                {
                    DMagic.DMAPI.deployDMExperiment(m, false); // maybe change this later
                    return(true);
                }
            }


            return(false);
        }
コード例 #9
0
 public void deployExperiment(ModuleScienceExperiment exp)
 {
     if (DMAPI.experimentCanConduct(exp as IScienceDataContainer))
     {
         DMAPI.deployDMExperiment(exp as IScienceDataContainer);
     }
 }
コード例 #10
0
        internal static bool IsExcluded(ModuleScienceExperiment exp)
        {
            bool b1 = excludedManufacturers.Contains(exp.part.partInfo.manufacturer);
            bool b2 = excludedExperiments.Contains(exp.experimentID);

            return(b1 | b2);
        }
コード例 #11
0
        public void Reset(ModuleScienceExperiment baseExperiment)
        {
            var currentExperiment = baseExperiment as DMModuleScienceAnimate;

            _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Reseting experiment");
            currentExperiment.ResetExperiment();
        }
コード例 #12
0
            /// <summary>
            /// Loads the experiment from the config node and attaches it to a vessel
            /// </summary>
            void AddScienceExperiment()
            {
                // If the Node is null, abort
                if (experimentNode == null)
                {
                    return;
                }

                // Create the ScienceExperiment
                Part kerbal = FlightGlobals.ActiveVessel.evaController.part;

                experiment = kerbal.AddModule(typeof(ModuleScienceExperiment).Name) as ModuleScienceExperiment;
                if (experiment == null)
                {
                    return;
                }

                // Load the experiment
                ConfigNode.LoadObjectFromConfig(experiment, experimentNode);

                // Deactivate some things
                experiment.resettable = false;

                // Start the experiment
                experiment.OnStart(PartModule.StartState.None);
                vesselID.Add(kerbal.vessel.id);
            }
コード例 #13
0
        public bool CanTransfer(ModuleScienceExperiment baseExperiment, ModuleScienceContainer moduleScienceContainer)
        {
            var currentExperiment = baseExperiment as DMModuleScienceAnimate;

            if ((currentExperiment as IScienceDataContainer).GetScienceCount() == 0)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment has no data skiping transfer. Data found: ", (currentExperiment as IScienceDataContainer).GetScienceCount(), "_", currentExperiment.experimentNumber);
                return(false);
            }
            if (!currentExperiment.IsRerunnable())
            {
                if (!_AutomatedScienceSamplerInstance.craftSettings.transferAllData)
                {
                    _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment isn't rerunnable and transferAllData is turned off.");
                    return(false);
                }
            }
            if (!_AutomatedScienceSamplerInstance.craftSettings.dumpDuplicates)
            {
                foreach (var data in (currentExperiment as IScienceDataContainer).GetData())
                {
                    if (moduleScienceContainer.HasData(data))
                    {
                        _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Target already has experiment and dumping is disabled.");
                        return(false);
                    }
                }
            }
            _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": We can transfer the science!");
            return(true);
        }
コード例 #14
0
        public float GetScienceValue(ModuleScienceExperiment baseExperiment, Dictionary <string, int> shipCotainsExperiments, ScienceSubject currentScienceSubject)
        {
            var currentExperiment = baseExperiment as DMModuleScienceAnimateGeneric.DMModuleScienceAnimateGeneric;
            var scienceExperiment = ResearchAndDevelopment.GetExperiment(baseExperiment.experimentID);

            return(Utilities.Science.GetScienceValue(shipCotainsExperiments, scienceExperiment, currentScienceSubject));
        }
コード例 #15
0
        public void Reset(ModuleScienceExperiment baseExperiment)
        {
            var currentExperiment = baseExperiment as DMModuleScienceAnimate;

            Log(currentExperiment.experimentID, ": Reseting experiment");
            currentExperiment.ResetExperiment();
        }
コード例 #16
0
        public bool CanRunExperiment(ModuleScienceExperiment baseExperiment, float currentScienceValue)
        {
            var currentExperiment = baseExperiment as DMModuleScienceAnimate;

            if (currentScienceValue < _AutomatedScienceSamplerInstance.craftSettings.threshold)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Science value is less than cutoff threshold: ", currentScienceValue, "<", _AutomatedScienceSamplerInstance.craftSettings.threshold);
                return(false);
            }
            if (!currentExperiment.rerunnable && !_AutomatedScienceSamplerInstance.craftSettings.oneTimeOnly)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Runing rerunable experiments is disabled");
                return(false);
            }
            if (currentExperiment.Inoperable)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment is inoperable");
                return(false);
            }
            if (currentExperiment.Deployed)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment is deployed");
                return(false);
            }
            if (!currentExperiment.experiment.IsUnlocked())
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment is locked");
                return(false);
            }
            return(DMAPI.experimentCanConduct(currentExperiment));
        }
コード例 #17
0
 float currentScienceValue(ModuleScienceExperiment e)
 {
     return(ResearchAndDevelopment.GetScienceValue(
                e.experiment.baseValue * e.experiment.dataScale,
                currentScienceSubject(e.experiment)
                ));
 }
コード例 #18
0
        public ExperimentObserver(StorageCache cache, ExperimentSettings expSettings, BiomeFilter filter,
                                  ScanInterface scanMapInterface, string expid, ModuleScienceExperiment exp = null)
        {
            settings            = expSettings;
            biomeFilter         = filter;
            requireControllable = true;
            if (exp != null)
            {
                rerunnable = exp.rerunnable;
                resettable = exp.resettable;
            }

            if (scanMapInterface == null)
            {
                scanMapInterface = new DefaultScanInterface();
            }

            scanInterface = scanMapInterface;

            experiment = ResearchAndDevelopment.GetExperiment(expid);

            if (experiment == null)
            {
                Log.Error("Failed to get experiment '{0}'", expid);
            }

            storage = cache;
            Rescan();
        }
コード例 #19
0
        protected override void OnEnabled()
        {
            _scienceExperiment = part.GetComponent <ModuleScienceExperiment>();

            DamageReceived += OnDamageReceived;
            DamageRepaired += OnDamageRepaired;
        }
コード例 #20
0
        public override void OnUpdate()
        {
            Debug.Log("[ModuleRobonautExperimentManager] - OnUpdate");
            base.OnUpdate();
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }
            Debug.Log("OnUpdate: " + this.part.partInfo.title);
            if (experiment == null)
            {
                experiment = this.part.FindModuleImplementing <ModuleScienceExperiment>();
            }
            if (experiment == null)
            {
                return;
            }

            Debug.Log("resettable: " + experiment.resettable);
            Debug.Log("dataIsCollectable: " + experiment.dataIsCollectable);
            Debug.Log("Deployed: " + experiment.Deployed);

            //Reset experiment
            Events["ResetExperiment"].active = experiment.Deployed && experiment.resettable && !FlightGlobals.ActiveVessel.isEVA;

            //Collect data
            Events["CollectData"].active = experiment.Deployed && experiment.dataIsCollectable && !FlightGlobals.ActiveVessel.isEVA;

            //Run experiment
            Events["RunExperiment"].active = !experiment.Deployed && !FlightGlobals.ActiveVessel.isEVA;
        }
コード例 #21
0
        public void RunStandardModuleScienceExperiment(ModuleScienceExperiment exp)
        {
            if (exp.Inoperable)
            {
                return;
            }

            if (Config.HideExperimentResultsDialog)
            {
                if (!exp.useStaging)
                {
                    exp.useStaging = true;
                    exp.OnActive();
                    exp.useStaging = false;
                }
                else
                {
                    exp.OnActive();
                }
            }
            else
            {
                exp.DeployExperiment();
            }
        }
コード例 #22
0
        public void Transfer(ModuleScienceExperiment baseExperiment, IScienceDataContainer moduleScienceContainer)
        {
            var currentExperiment = baseExperiment as DMModuleScienceAnimate;

            Log(currentExperiment.experimentID, ": transfering");
            moduleScienceContainer.StoreData(currentExperiment, _AutomatedScienceSamplerInstance.craftSettings.dumpDuplicates);
        }
コード例 #23
0
        public static ExpStatus Load(ConfigNode node, SkylabExperiment instance = null)
        {
            var expStatus = new ExpStatus();

            node.TryGetValue("expId", ref expStatus.expId);
            node.TryGetValue("key", ref expStatus.key);
            node.TryGetValue("bodyName", ref expStatus.bodyName);
            node.TryGetEnum <ExperimentSituations>("vesselSit", ref expStatus.vesselSit, 0);
            node.TryGetValue("biome", ref expStatus.biome);
            node.TryGetValue("processedResource", ref expStatus.processedResource);
            node.TryGetValue("reqResource", ref expStatus.reqResource);
            node.TryGetValue("reqAmount", ref expStatus.reqAmount);
            node.TryGetValue("active", ref expStatus.active);
            node.TryGetValue("lastTimeUpdated", ref expStatus.lastTimeUpdated);
            if (expStatus.active)
            {
                ModuleScienceExperiment exp = new ModuleScienceExperiment();
                exp.experimentID = expStatus.expId;
                if (experiments[expStatus.expId].xmitDataScalar > 0)
                {
                    exp.xmitDataScalar = experiments[expStatus.expId].xmitDataScalar;
                }

                if (instance != null)
                {
                    instance.SetUpActiveExperiment(expStatus.expId, expStatus.biome, exp, expStatus.reqResource, expStatus.processedResource);
                }
            }
#if false
            Log.Info("ExpStatus.Load, expId: " + expStatus.expId + ", key: " + expStatus.key + ", bodyName: " + expStatus.bodyName +
                     ", vesselSit: " + expStatus.vesselSit + ", biome: " + expStatus.biome + ", processedResource: " + expStatus.processedResource +
                     ", reqAmount: " + expStatus.reqAmount + ", active: " + expStatus.active);
#endif
            return(expStatus);
        }
コード例 #24
0
        /// <summary>
        /// Get the ScienceSubject for an asteroid experiment.
        /// </summary>
        /// <param name="mse">The science experiment module must be cast as a ModuleScienceExperiment.</param>
        /// <param name="sit">The current Experiment Situation value; see the getExperimentSituation method above.</param>
        /// <returns>Returns the ScienceSubject for that specific asteroid, experiment, and ExperimentSituation; returns null if the module is not of the right type, the experiment is not suitable for astroids, if no asteroids are detected, or if the current asteroid situation is not suitable for the experiment.</returns>
        public static ScienceSubject getAsteroidSubject(ModuleScienceExperiment mse, ExperimentSituations sit)
        {
            if (mse == null)
            {
                return(null);
            }

            Type t = mse.GetType();

            if (t != typeof(DMModuleScienceAnimateGeneric_NM.DMModuleScienceAnimateGeneric))
            {
                return(null);
            }

            DMModuleScienceAnimateGeneric_NM.DMModuleScienceAnimateGeneric DMMod = (DMModuleScienceAnimateGeneric_NM.DMModuleScienceAnimateGeneric)mse;

            if (!isAsteroidExperiment(DMMod))
            {
                return(null);
            }

            if (DMMod.scienceExp == null)
            {
                return(null);
            }

            if (sit == ExperimentSituations.InSpaceLow)
            {
                if (!isAsteroidNear())
                {
                    return(null);
                }
            }
            else if (sit == ExperimentSituations.SrfLanded)
            {
                if (!isAsteroidGrappled())
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }

            if ((DMMod.scienceExp.situationMask & (int)sit) == 0)
            {
                return(null);
            }

            string oldBodyName = FlightGlobals.Bodies[16].bodyName;

            DMAsteroidScienceGen newAsteroid = new DMAsteroidScienceGen();
            ScienceSubject       sub         = new ScienceSubject(DMMod.scienceExp, sit, newAsteroid.Body, newAsteroid.AClass);

            sub.subjectValue          = newAsteroid.SciMult;
            sub.scienceCap            = DMMod.scienceExp.scienceCap * sub.subjectValue;
            newAsteroid.Body.bodyName = oldBodyName;
            return(sub);
        }
コード例 #25
0
ファイル: DMAPI.cs プロジェクト: zantoku/Orbital-Science
        /// <summary>
        /// Get the ScienceSubject for an asteroid experiment.
        /// </summary>
        /// <param name="mse">The science experiment module must be cast as a ModuleScienceExperiment.</param>
        /// <returns>Returns the ScienceSubject for that specific asteroid and experiment; returns null if the module is not of the right type, the experiment is not suitable for astroids, if no asteroids are detected, or if the current asteroid situation is not suitable for the experiment.</returns>
        public static ScienceSubject getAsteroidSubject(ModuleScienceExperiment mse)
        {
            if (mse == null)
            {
                return(null);
            }

            Type t = mse.GetType();

            if (!(t.IsSubclassOf(typeof(DMModuleScienceAnimate)) || t == typeof(DMModuleScienceAnimate)))
            {
                return(null);
            }

            DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)mse;

            if (!isAsteroidExperiment(DMMod))
            {
                return(null);
            }

            if (DMMod.scienceExp == null)
            {
                return(null);
            }

            if (DMAsteroidScience.AsteroidGrappled)
            {
                if ((DMMod.scienceExp.situationMask & (int)ExperimentSituations.SrfLanded) == 0)
                {
                    return(null);
                }

                string oldBodyName = FlightGlobals.Bodies[16].bodyName;

                DMAsteroidScience newAsteroid = new DMAsteroidScience();
                ScienceSubject    sub         = new ScienceSubject(DMMod.scienceExp, ExperimentSituations.SrfLanded, newAsteroid.Body, newAsteroid.AType + newAsteroid.ASeed.ToString());
                sub.subjectValue          = newAsteroid.SciMult;
                newAsteroid.Body.bodyName = oldBodyName;
                return(sub);
            }
            else if (DMAsteroidScience.AsteroidNear)
            {
                if ((DMMod.scienceExp.situationMask & (int)ExperimentSituations.InSpaceLow) == 0)
                {
                    return(null);
                }

                string oldBodyName = FlightGlobals.Bodies[16].bodyName;

                DMAsteroidScience newAsteroid = new DMAsteroidScience();
                ScienceSubject    sub         = new ScienceSubject(DMMod.scienceExp, ExperimentSituations.InSpaceLow, newAsteroid.Body, newAsteroid.AType + newAsteroid.ASeed.ToString());
                sub.subjectValue          = newAsteroid.SciMult;
                newAsteroid.Body.bodyName = oldBodyName;
                return(sub);
            }

            return(null);
        }
コード例 #26
0
        private void OnExperimentsResultDialogClosed()
        {
            if (FlightGlobals.ActiveVessel != null)
            {
                // get all container modules on the vessel
                List <ModuleScienceContainer> containers = FlightGlobals.ActiveVessel.FindPartModulesImplementing <ModuleScienceContainer>();

                // iterate over the containers
                for (int containerIndex = 0; containerIndex < containers.Count; containerIndex++)
                {
                    ModuleScienceContainer container = containers[containerIndex];

                    // get all the experiment modules attached to the same part as the container
                    List <ModuleScienceExperiment> experiments = container.part.FindModulesImplementing <ModuleScienceExperiment>();

                    // iterate over the experiments
                    for (int experimentIndex = 0; experimentIndex < experiments.Count; experimentIndex++)
                    {
                        ModuleScienceExperiment experiment = experiments[experimentIndex];

                        // check that experiment has available data
                        if (experiment.GetScienceCount() > 0)
                        {
                            // get both the container and experiment data for duplicate checking
                            ScienceData[] containerDataArray  = container.GetData();
                            ScienceData[] experimentDataArray = experiment.GetData();

                            // iterate over the experiment data
                            foreach (ScienceData experimentData in experimentDataArray)
                            {
                                bool allowDataTransfer = true;

                                // check for duplicates in the container data
                                foreach (ScienceData containerData in containerDataArray)
                                {
                                    if (containerData.subjectID == experimentData.subjectID)
                                    {
                                        allowDataTransfer = false;

                                        // discard duplicates
                                        if (HighLogic.CurrentGame.Parameters.CustomParams <SMR>().discardDuplicates)
                                        {
                                            experiment.DumpData(experimentData);
                                        }
                                    }
                                }

                                // transfer data from experiment to container
                                if (allowDataTransfer)
                                {
                                    experiment.DumpData(experimentData);
                                    container.AddData(experimentData);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #27
0
ファイル: DMagic.cs プロジェクト: ntwest/KSP-X-Science
 public static ExperimentSituations getSituation(ModuleScienceExperiment mse)
 {
     if (_MIgetSituation == null)
     {
         return(ExperimentSituations.InSpaceHigh);
     }
     return((ExperimentSituations)_MIgetSituation.Invoke(mse, new object[] { }));
 }
コード例 #28
0
ファイル: DMagic.cs プロジェクト: ntwest/KSP-X-Science
 public static string getBiome(ModuleScienceExperiment mse, ExperimentSituations sit)
 {
     if (_MIgetBiome == null)
     {
         return("");
     }
     return((string)_MIgetBiome.Invoke(mse, new object[] { sit }));
 }
コード例 #29
0
 public void resetExperiment(ModuleScienceExperiment exp)
 {
     (exp as DMModuleScienceAnimate).ResetExperiment();
     if ((exp as DMModuleScienceAnimate).IsDeployed)
     {
         (exp as DMModuleScienceAnimate).retractEvent();
     }
 }
コード例 #30
0
ファイル: ForScience.cs プロジェクト: MMaster/ForScience
        float currentScienceValue(ModuleScienceExperiment currentExperiment) // the ammount of science an experiment should return
        {
            ScienceExperiment se = ResearchAndDevelopment.GetExperiment(currentExperiment.experimentID);

            return(ResearchAndDevelopment.GetScienceValue(
                       se.baseValue * se.dataScale,
                       currentScienceSubject(se)));
        }
コード例 #31
0
        public ScienceExperimentFields(ModuleScienceExperiment module, SharedObjects sharedObj) : base(module, sharedObj)
        {
            this.module = module;

            gatherDataMethod = module.GetType().GetMethod("gatherData",
                BindingFlags.NonPublic | BindingFlags.Instance);
            resetExperimentMethod = module.GetType().GetMethod("resetExperiment",
                BindingFlags.NonPublic | BindingFlags.Instance);
            sendDataToCommsMethod = module.GetType().GetMethod("sendDataToComms",
                BindingFlags.NonPublic | BindingFlags.Instance);
            dumpDataMethod = module.GetType().GetMethod("dumpData",
                BindingFlags.NonPublic | BindingFlags.Instance);

            InitializeSuffixes();
        }
コード例 #32
0
        private static void PrepareExternalModules(Item moduleNode, ModuleScienceExperiment moduleScienceExperiment,
            ScienceExperiment experiment)
        {
            if (moduleNode != null)
            {
                Type t = moduleScienceExperiment.GetType();
                //var meth = t.GetMethod("");

                //meth.Invoke(moduleScienceExperiment, new object[]{12, 2, 6});
                var field = t.GetField(moduleNode.Biome);
                if (field != null)
                {
                    var value = field.GetValue(moduleScienceExperiment);
                    experiment.biomeMask = Convert.ToUInt32(value);
                }
                else
                {
                    var property = t.GetProperty(moduleNode.Biome);
                    if (property != null)
                    {
                        var value = property.GetValue(moduleScienceExperiment, null);
                        experiment.biomeMask = Convert.ToUInt32(value);
                    }
                }

                field = t.GetField(moduleNode.Situation);
                if (field != null)
                {
                    var value = field.GetValue(moduleScienceExperiment);
                    experiment.situationMask = Convert.ToUInt32(value);
                }
                else
                {
                    var property = t.GetProperty(moduleNode.Situation);
                    if (property != null)
                    {
                        var value = property.GetValue(moduleScienceExperiment, null);
                        experiment.situationMask = Convert.ToUInt32(value);
                    }
                }
            }
        }
コード例 #33
0
 private ScienceData newScienceData(ModuleScienceExperiment currentExperiment)
 {
     return new ScienceData(
                 currentExperiment.experiment.baseValue * currentScienceSubject(currentExperiment.experiment).dataScale,
                 currentExperiment.xmitDataScalar,
                 0f,
                 currentScienceSubject(currentExperiment.experiment).id,
                 currentScienceSubject(currentExperiment.experiment).title
                 );
 }
コード例 #34
0
        public void addPartExperiment(ModuleScienceExperiment m, ScienceExperiment e)
        {
            Notes_Experiment exp = new Notes_Experiment(this, m, e, 1);

            if (!allExperiments.Contains(exp))
                allExperiments.Add(exp);
        }
コード例 #35
0
 public Notes_Experiment(Notes_ExpPart r, ModuleScienceExperiment m, ScienceExperiment e, int limit = 1)
 {
     root = r;
     experimentModule = m;
     experiment = e;
     name = e.experimentTitle;
     dataLimit = limit;
 }
コード例 #36
0
 private void DeployExperiment(ModuleScienceExperiment currentExperiment)
 {
     try//taken from ScienceAlert since .DeployExperiment() didnt work and i didnt know about this
       {
     // Get the most-derived type and use its DeployExperiment so we don't
     // skip any plugin-derived versions
     currentExperiment.GetType().InvokeMember("DeployExperiment", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.IgnoreReturn | System.Reflection.BindingFlags.InvokeMethod, null, currentExperiment, null);
       }
       catch (Exception e)
       {
     Utilities.debug(modName, Utilities.LogMode.Error, "Failed to invoke \"DeployExperiment\" using GetType(), falling back to base type after encountering exception " + e);
     currentExperiment.DeployExperiment();
       }
 }
コード例 #37
0
 private bool canTransfer(ModuleScienceExperiment thisExperiment, ScienceData[] containingData)
 {
     if (!thisExperiment.IsRerunnable())
       {
     if (currentSettings.getBool("transferAll"))
     {
       return true;
     }
     else
     {
       return false;
     }
       }
       if (!currentSettings.getBool("dumpDuplicateResults"))
       {
     foreach (var data in thisExperiment.GetData())
     {
       if (containingData.Contains(data))
       {
     return false;
       }
     }
       }
       return true;
 }
コード例 #38
0
 private bool isExperimentLimitReached(ModuleScienceExperiment currentExperiment, ScienceExperiment experiment, ScienceSubject currentScienceSubject, ref float currentScienceValue)
 {
     try
       {
     int experimentNumber, experimentLimit;
     if (int.TryParse(currentExperiment.GetType().GetField("experimentNumber").GetValue(currentExperiment).ToString(), out  experimentNumber) &&
     int.TryParse(currentExperiment.GetType().GetField("experimentLimit").GetValue(currentExperiment).ToString(), out  experimentLimit))
     {
       if ((experimentNumber >= experimentLimit) && experimentLimit >= 1)
       {
     Utilities.debug(modName, Utilities.LogMode.Log, "Experiment {0} can't be conducted cause the experimentLimit is reached!", experiment.id);
     return true;
       }
       else if (experimentNumber > 0)
       {
     addToContainer(currentScienceSubject.id, experimentNumber);
     currentScienceValue = Utilities.Science.getScienceValue(shipCotainsExperiments, experiment, currentScienceSubject);
     Utilities.debug(modName, Utilities.LogMode.Log, "Experiment is a DMagic Orbital Science experiment. Science value changed to: " + currentScienceValue);
     if (currentScienceValue < currentSettings.getFloat("scienceCutoff"))
     {
       Utilities.debug(modName, Utilities.LogMode.Log, "Experiment is a DMagic Orbital Science experiment. Science value droped below cutoff.");
       return true;
     }
       }
     }
       }
       catch (Exception)
       {
       }
       return false;
 }
コード例 #39
0
        private bool canRunExperiment(ModuleScienceExperiment currentExperiment, ScienceExperiment experiment, float currentScienceValue, bool DMagic = false)
        {
            if (!DMagic)
              {
            if (!experiment.IsAvailableWhile(currentSituation, currentBody))//
            {
              //experiment.mask
              Utilities.debug(modName, Utilities.LogMode.Debug, currentExperiment.experimentID + ": Experiment isn't available in the current situation: " + currentSituation + "_" + currentBody + "_" + experiment.situationMask);
              return false;
            }
            if (currentExperiment.Inoperable)//
            {
              Utilities.debug(modName, Utilities.LogMode.Debug, currentExperiment.experimentID + ": Experiment is inoperable");
              return false;
            }
            if (currentExperiment.Deployed)//
            {
              Utilities.debug(modName, Utilities.LogMode.Debug, currentExperiment.experimentID + ": Experiment is deployed");
              return false;
            }
              }
              if (!currentExperiment.rerunnable && !currentSettings.getBool("runOneTimeScience"))
              {
            Utilities.debug(modName, Utilities.LogMode.Debug, currentExperiment.experimentID + ": Runing rerunable experiments is disabled");
            return false;
              }
              if (currentScienceValue < currentSettings.getFloat("scienceCutoff"))
              {
            Utilities.debug(modName, Utilities.LogMode.Debug, currentExperiment.experimentID + ": Science value is less than cutoff threshold: " + currentScienceValue + "<" + currentSettings.getFloat("scienceCutoff"));
            return false;
              }
              if (!experiment.IsUnlocked())
              {
            Utilities.debug(modName, Utilities.LogMode.Debug, currentExperiment.experimentID + ": Experiment is locked");
            return false;
              }

              var ModuleAnimateGeneric = currentExperiment.part.FindModuleImplementing<ModuleAnimateGeneric>();
              if (ModuleAnimateGeneric != null)
              {
            if (ModuleAnimateGeneric.status != "Locked")
            {
              Utilities.debug(modName, Utilities.LogMode.Debug, "Animation status isn't locked:" + ModuleAnimateGeneric.status + "_" + currentExperiment.part.name);
              return false;
            }
              }
              return true;
        }
コード例 #40
0
    void drawExperiment(ModuleScienceExperiment experiment)
    {
        var page = pages.Find(p => p.host == experiment.part);
        var data = experiment.GetData()[0];
        bool hasData = data != null;
        string stats = "";

        if (hasData) {
            var sv = simulateScience(data);
            var tsv = simulateScience(data, true);
            dataAmount += data.dataAmount;
            returnScience += sv;
            transmitScience += tsv;
            stats = string.Format("( {0:F1} / {1:F1} )", sv, tsv);

            if (page != null) {
                var sub = ResearchAndDevelopment.GetSubjectByID(data.subjectID);
                if (sub.science < sub.scienceCap) {
                    page.OnKeepData(page.pageData);
                }
                else {
                    page.OnDiscardData(page.pageData);
                }
            }
        }

        ScienceExperiment exp = ResearchAndDevelopment.GetExperiment(experiment.experiment.id);
        string tooltip = "";

        CelestialBody body = experiment.vessel.mainBody;
        foreach (ExperimentSituations sit in Enum.GetValues(typeof(ExperimentSituations)))
        {
            if (exp.IsAvailableWhile(sit, body) &&
                 !((sit == ExperimentSituations.FlyingHigh || sit == ExperimentSituations.FlyingLow) && !body.atmosphere) &&
                 !(sit == ExperimentSituations.SrfSplashed && !body.ocean)
               )
            {
                string key;
                if (exp.BiomeIsRelevantWhile(sit))
                {
                    if (body.BiomeMap != null && body.BiomeMap.Attributes != null)
                        foreach (CBAttributeMap.MapAttribute biome in body.BiomeMap.Attributes)
                        {
                            ScienceSubject sub = ResearchAndDevelopment.GetExperimentSubject(exp, sit, body, biome.name);
                            tooltip += body.name + " " + sit.ToString() + " " + biome.name + " " + sub.science.ToString("F1") + "/" + Mathf.RoundToInt(sub.scienceCap) + "\n";

                        }
                    if (body.name == "Kerbin")
                    {
                        string[] specials = { "KSC", "Runway", "Launchpad" };
                        foreach (string special in specials)
                        {
                            ScienceSubject sub = ResearchAndDevelopment.GetExperimentSubject(exp, sit, body, special);
                            tooltip += body.name + " " + sit.ToString() + " " + special + " " + sub.science.ToString("F1") + "/" + Mathf.RoundToInt(sub.scienceCap) + "\n";

                        }
                    }
                }
                else
                {
                    key = body.name + sit.ToString();
                    ScienceSubject sub = ResearchAndDevelopment.GetExperimentSubject(exp, sit, body, "");
                    if (sub != null)
                        tooltip += body.name + " " + sit.ToString() + " " +  sub.science.ToString("F1") + "/" + Mathf.RoundToInt(sub.scienceCap) + "\n";
                    else
                        tooltip += body.name + " " + sit.ToString() + " 0/" + Mathf.RoundToInt(exp.scienceCap) + "\n";
                }
            }
        }

        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal(GUILayout.MaxHeight(18));
        GUILayout.Label(new GUIContent(experiment.experimentID + (stats != "" ? " - " + stats : ""), tooltip), styleTitle);
        if (hasData) {
            GUILayout.Label(data.title, styleTitle);
        }
        GUILayout.FlexibleSpace();
        if (GUILayout.Button((hasData ? "Reset" : "Deploy"), new GUILayoutOption[] { GUILayout.MaxHeight(18), GUILayout.ExpandWidth(false) })) {
            if (hasData) {
                experiment.ResetExperiment();
            }
            else {
                experiment.DeployExperiment();
        //				experiment.StartCoroutine((IEnumerator)miGatherData.Invoke(experiment, new object[] { false })); // KSP doesn't like window free results yet
            }
        }
        GUILayout.Space(5);
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
    }
コード例 #41
0
        /// <summary>
        /// For external use to determine if a module can conduct science
        /// </summary>
        /// <param name="MSE">The base ModuleScienceExperiment instance</param>
        /// <returns>True if the experiment can be conducted under current conditions</returns>
        public static bool conduct(ModuleScienceExperiment MSE)
        {
            if (MSE.GetType() != typeof(DMModuleScienceAnimate))
                return false;

            DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)MSE;
            try
            {
                return DMMod.canConduct();
            }
            catch (Exception e)
            {
                Debug.LogWarning("[DM] Error in casting ModuleScienceExperiment to DMModuleScienceAnimate; Invalid Part Module... : " + e);
                return false;
            }
        }
コード例 #42
0
ファイル: Scatter.cs プロジェクト: Kerbas-ad-astra/Kopernicus
            /// <summary>
            /// Create colliders for the scatter
            /// </summary>
            void Start()
            {
                // Register us as the parental object for the scatter
                PQSLandControl landControl = transform.parent.GetComponentInChildren<PQSLandControl>();
                PQSLandControl.LandClassScatter scatter = landControl.scatters.First(s => s.scatterName == name.Split(' ').Last());
                scatter.GetType().GetField("scatterParent", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(scatter, gameObject);

                // The ConfigNode is lost, so find it again!
                PSystemBody body = PSystemManager.Instance.systemPrefab.GetComponentsInChildren<PSystemBody>(true).First(b => b.name == transform.parent.name);
                experiment = body.pqsVersion.gameObject.GetChild(name).GetComponent<Scatter>().experiment;
            }
コード例 #43
0
 public ExperimentAssistant(ModuleScienceExperiment experiment)
 {
     this.experiment = experiment;
 }
コード例 #44
0
ファイル: Scatter.cs プロジェクト: Kerbas-ad-astra/Kopernicus
            /// <summary>
            /// Loads the experiment from the config node and attaches it to a vessel
            /// </summary>
            void AddScienceExperiment()
            {
                // If the Node is null, abort
                if (experimentNode == null)
                    return;

                // Create the ScienceExperiment
                Part kerbal = FlightGlobals.ActiveVessel.evaController.part;
                experiment = kerbal.AddModule(typeof(ModuleScienceExperiment).Name) as ModuleScienceExperiment;

                // Load the experiment
                ConfigNode.LoadObjectFromConfig(experiment, experimentNode);

                // Deactivate some things
                experiment.resettable = false;

                // Start the experiment
                experiment.OnStart(PartModule.StartState.None);
                vesselID.Add(kerbal.vessel.id);
            }
コード例 #45
0
        private bool canConduct(ModuleScienceExperiment currentExperiment, ScienceExperiment experiment)
        {
            try
              {
            MethodInfo conductMethod = currentExperiment.GetType().BaseType.GetMethod("canConduct", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod);
            if (conductMethod == null)
            {
              conductMethod = currentExperiment.GetType().GetMethod("canConduct", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod);
            }
            if (conductMethod != null)
            {
              var conductResult = (bool)conductMethod.Invoke(currentExperiment, null);

              if (!conductResult)
              {
            Utilities.debug(modName, Utilities.LogMode.Debug, "Experiment {0} can't be conducted.", experiment.id);
            return false;
              }
              return true;
            }
            else
            {
              Utilities.debug(modName, Utilities.LogMode.Error, experiment.id + ": conductMethod == null");
            }
              }
              catch (Exception e)
              {
            Utilities.debug(modName, Utilities.LogMode.Exception, e.Message);
              }
              return false;
        }
コード例 #46
0
 private bool canResetExperiment(ModuleScienceExperiment currentExperiment)
 {
     if (!hasScientist)
     return false;
       if (!currentSettings.getBool("resetExperiments"))
     return false;
       if (!currentExperiment.Inoperable)
     return false;
       return true;
 }
コード例 #47
0
 public override void OnStart(PartModule.StartState state)
 {
     experiment = this.GetComponent<ModuleScienceExperiment>();
       if (experiment != null)
       {
     baseValue = experiment.experiment.baseValue;
       }
 }
コード例 #48
0
 private void SetScienceExperimentInfo()
 {
     moduleScienceExperiment = selectedPart.GetModule<ModuleScienceExperiment>();
     if (moduleScienceExperiment != null)
     {
         infoItems.Add(PartInfoItem.Create("Science Experiment", moduleScienceExperiment.experimentActionName));
         infoItems.Add(PartInfoItem.Create("\tTransmit Efficiency", moduleScienceExperiment.xmitDataScalar.ToPercent()));
         if (moduleScienceExperiment.rerunnable == false)
         {
             infoItems.Add(PartInfoItem.Create("\tSingle Usage"));
         }
     }
 }
コード例 #49
0
 public StockScienceExperimentFields(ModuleScienceExperiment module, SharedObjects sharedObj)
     : base(module, sharedObj)
 {
     this.module = module;
 }
コード例 #50
0
        private void PrepareInfoDescription(AvailablePart part, ModuleScienceExperiment moduleScienceExperiment,
            string[] itemInfo)
        {
            try
            {
                foreach (var item in _items)
                {
                    var infos = part.moduleInfos.Where(
                        x => item.ExperimentTitle.Contains(x.moduleName.ToLower()));

                    if (!infos.Any()) continue;
                    var d =
                        infos.FirstOrDefault(
                            x =>
                                x.info.Contains(
                                    string.IsNullOrEmpty(moduleScienceExperiment.experimentActionName)
                                        ? moduleScienceExperiment.experimentID
                                        : moduleScienceExperiment.experimentActionName));
                    if (d == null) continue;
                    d.info = string.Concat(d.info, "\n", GetInfo(itemInfo, _usageMaskInt));
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
コード例 #51
0
    void drawExperiment(ModuleScienceExperiment experiment)
    {
        var page = pages.Find(p => p.host == experiment.part);
        var data = experiment.GetData()[0];
        bool hasData = data != null;
        string stats = "";

        if (hasData) {
            var sv = simulateScience(data);
            var tsv = simulateScience(data, true);
            dataAmount += data.dataAmount;
            returnScience += sv;
            transmitScience += tsv;
            stats = string.Format("( {0:F1} / {1:F1} )", sv, tsv);

            if (page != null) {
                var sub = ResearchAndDevelopment.GetSubjectByID(data.subjectID);
                if (sub.science < sub.scienceCap) {
                    page.OnKeepData(page.pageData);
                }
                else {
                    page.OnDiscardData(page.pageData);
                }
            }
        }

        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal(GUILayout.MaxHeight(18));
        GUILayout.Label(experiment.experimentID + (stats != "" ? " - " + stats : ""), styleTitle);
        if (hasData) {
            GUILayout.Label(data.title, styleTitle);
        }
        GUILayout.FlexibleSpace();
        if (GUILayout.Button((hasData ? "Reset" : "Deploy"), new GUILayoutOption[] { GUILayout.MaxHeight(18), GUILayout.ExpandWidth(false) })) {
            if (hasData) {
                experiment.ResetExperiment();
            }
            else {
                experiment.DeployExperiment();
        //				experiment.StartCoroutine((IEnumerator)miGatherData.Invoke(experiment, new object[] { false })); // KSP doesn't like window free results yet
            }
        }
        GUILayout.Space(5);
        GUILayout.EndHorizontal();

        GUILayout.EndVertical();
    }
コード例 #52
0
 private void createScienceDMagic(ModuleScienceExperiment currentExperiment, ScienceSubject currentScienceSubject, float currentScienceValue)
 {
     var scienceData = new ScienceData(currentScienceValue, currentExperiment.xmitDataScalar, 0, currentScienceSubject.id, currentScienceSubject.title);
       try
       {
     currentExperiment.GetType().InvokeMember("deployEvent", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.IgnoreReturn | System.Reflection.BindingFlags.InvokeMethod, null, currentExperiment, null);
       }
       catch (Exception)
       {
       }
       if (!currentExperiment.rerunnable)
       {
     currentExperiment.SetInoperable();
     GameEvents.OnExperimentDeployed.Fire(scienceData);
       }
       container.AddData(scienceData);
 }
コード例 #53
0
 public DMModuleScienceAnimateFields(ModuleScienceExperiment module, SharedObjects sharedObj)
     : base(module, sharedObj)
 {
     InitializeSuffixes();
 }
コード例 #54
0
 private void getBiomeDMagic(ModuleScienceExperiment currentExperiment, ref string biome)
 {
     //getBiome
       try
       {
     MethodInfo getBiomeMethod = currentExperiment.GetType().GetMethod("getBiome", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.InvokeMethod);
     if (getBiomeMethod != null)
     {
       biome = (string)getBiomeMethod.Invoke(currentExperiment, new object[] { currentSituation });
       Utilities.debug(modName, Utilities.LogMode.Debug, "found getBiomeMethod:" + biome);
     }
     else
     {
       Utilities.debug(modName, Utilities.LogMode.Debug, "getBiomeMethod is null");
     }
       }
       catch (Exception e)
       {
     Utilities.debug(modName, Utilities.LogMode.Exception, e.Message);
       }
 }
コード例 #55
0
 private void PrepareUsage(ModuleScienceExperiment moduleScienceExperiment)
 {
     switch (moduleScienceExperiment.usageReqMaskInternal)
     {
         case -1:
             _usageMaskInt = "<i><color=red>Experiment can't be used at all.</color></i>";
             break;
         case 0:
             _usageMaskInt = "<i><color=maroon>Experiment can always be used.</color></i>";
             break;
         case 1:
             _usageMaskInt = "<i><color=green>Experiment can be used if vessel is under control.</color></i>";
             break;
         case 2:
             _usageMaskInt = "<i><color=lime>Experiment can only be used if vessel is crewed.</color></i>";
             break;
         case 4:
             _usageMaskInt = "<i><color=teal>Experiment can only be used if part contains crew.</color></i>";
             break;
         case 8:
             _usageMaskInt = "<i><color=purple>Experiment can only be used if crew is scientist.</color></i>";
             break;
     }
 }
コード例 #56
0
 private static void createScience(ModuleScienceExperiment currentExperiment)
 {
     //Need something like this for DMagic experiments!
       var stagingSetting = currentExperiment.useStaging;
       currentExperiment.useStaging = true;//work the way around the staging
       currentExperiment.OnActive();//run the experiment without causing the report to show up
       currentExperiment.useStaging = stagingSetting;//set the staging back
 }
コード例 #57
0
 // construct our own science data for an experiment
 ScienceData newScienceData(ModuleScienceExperiment currentExperiment)
 {
     return new ScienceData(
                amount: currentExperiment.experiment.baseValue * currentScienceSubject(currentExperiment.experiment).dataScale,
                xmitValue: currentExperiment.xmitDataScalar,
                xmitBonus: 0f,
                id: currentScienceSubject(currentExperiment.experiment).id,
                dataName: currentScienceSubject(currentExperiment.experiment).title
                );
 }
コード例 #58
0
 private void CheckForDataToCollect(ModuleScienceExperiment currentExperiment)
 {
     if (IsDataToCollect)
     return;
       if (!currentSettings.getBool("transferScience"))
     return;
       if (currentExperiment.Deployed && currentExperiment.dataIsCollectable)
       {
     if (currentExperiment.IsRerunnable() && !currentSettings.getBool("transferAll"))
       return;
     IsDataToCollect = true;
       }
 }
コード例 #59
0
 private void ResetExperiment(ModuleScienceExperiment currentExperiment)
 {
     //Same as DeployExperiment just switched out the name
       try
       {
     currentExperiment.GetType().InvokeMember("ResetExperiment", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.IgnoreReturn | System.Reflection.BindingFlags.InvokeMethod, null, currentExperiment, null);
       }
       catch (Exception e)
       {
     Utilities.debug(modName, Utilities.LogMode.Error, "Failed to invoke \"ResetExperiment\" using GetType(). " + e);
     currentExperiment.ResetExperiment();
       }
       currentExperiment.Inoperable = false;
 }
コード例 #60
0
 // the ammount of science an experiment should return
 float currentScienceValue(ModuleScienceExperiment currentExperiment)
 {
     return ResearchAndDevelopment.GetScienceValue(
                             currentExperiment.experiment.baseValue * currentExperiment.experiment.dataScale,
                             currentScienceSubject(currentExperiment.experiment));
 }