Ejemplo n.º 1
0
        private void Log(params object[] msg)
        {
            var debugStringBuilder = new StringBuilder();

            foreach (var debugString in msg)
            {
                debugStringBuilder.Append(debugString.ToString());
            }
            _AutomatedScienceSamplerInstance.Log("[Default]", debugStringBuilder);
        }
        public void Log(params object[] msg)
        {
            if (_AutomatedScienceSamplerInstance == null)
            {
                return;
            }
            var debugStringBuilder = new StringBuilder();

            foreach (var debugString in msg)
            {
                debugStringBuilder.Append(debugString.ToString());
            }
            _AutomatedScienceSamplerInstance.Log("[" + _typeName + "]", debugStringBuilder);
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
0
        public bool CanRunExperiment(ModuleScienceExperiment baseExperiment, float currentScienceValue)
        {
            var currentExperiment = baseExperiment as StationExperiment;
            var isActive          = currentExperiment.Events["StartExperiment"].active;

            if (isActive)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": StationExperiment didn't start yet! You might want to start it manually!");
                return(false);
            }
            if (StationExperiment.checkBoring(FlightGlobals.ActiveVessel, false))
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": StationExperiment says this location is boring!");
                return(false);
            }
            if (!currentExperiment.finished() && !isActive)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": StationExperiment isn't finished yet!");
                return(false);
            }
            if (!currentExperiment.experiment.IsAvailableWhile(ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel), FlightGlobals.currentMainBody))//
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment isn't available in the current situation: ", ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel), "_", FlightGlobals.currentMainBody + "_", currentExperiment.experiment.situationMask);
                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.rerunnable && !_AutomatedScienceSamplerInstance.craftSettings.oneTimeOnly)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Runing rerunable experiments is disabled");
                return(false);
            }
            if (currentScienceValue < _AutomatedScienceSamplerInstance.craftSettings.threshold)
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Science value is less than cutoff threshold: ", currentScienceValue, "<", _AutomatedScienceSamplerInstance.craftSettings.threshold);
                return(false);
            }
            if (!currentExperiment.experiment.IsUnlocked())
            {
                _AutomatedScienceSamplerInstance.Log(currentExperiment.experimentID, ": Experiment is locked");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 5
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);
        }