public virtual bool Deploy()
        {
            if (!Available)
            {
                return(false);
            }
            if (FlightGlobals.ActiveVessel == null)
            {
                return(false);
            }
            if (requireControllable && !FlightGlobals.ActiveVessel.IsControllable)
            {
                return(false);
            }

            var exp = GetNextOnboardExperimentModule();

            if (!exp)
            {
                return(false);
            }



            if (!(DMagicFactory.DMagic_IsInstalled && DMagicFactory.RunExperiment(experiment.id, exp)) &&
                !(DMagicFactory.DMagicScienceAnimateGeneric_IsInstalled && DMagicFactory.RunSciAnimGenExperiment(experiment.id, exp)))
            {
                exp.DeployExperiment();
                return(true);
            }
            return(false);
        }
        public override bool Deploy()
        {
            if (!Available || !IsReadyOnboard)
            {
                return(false);
            }
            if (FlightGlobals.ActiveVessel == null)
            {
                return(false);
            }

            if (!FlightGlobals.ActiveVessel.isEVA)
            {
                if (FlightGlobals.getStaticPressure() > Settings.Instance.EvaAtmospherePressureWarnThreshold)
                {
                    if (FlightGlobals.ActiveVessel.GetSrfVelocity().magnitude > Settings.Instance.EvaAtmosphereVelocityWarnThreshold)
                    {
                        DialogGUIBase[] options = new DialogGUIBase[2]
                        {
                            new DialogGUIButton("Science is worth a little risk", OnConfirmEva),
                            new DialogGUIButton("No, it would be a PR nightmare", null)
                        };

                        var multiOptionDialog = new MultiOptionDialog(
                            "It looks dangerous out there. Are you sure you want to send someone out? They might lose their grip!",
                            "It looks dangerous out there. Are you sure you want to send someone out? They might lose their grip!",
                            "Dangerous Condition Alert",
                            HighLogic.UISkin, options);
                        PopupDialog.SpawnPopupDialog(multiOptionDialog, false, HighLogic.UISkin);
                        return(true);
                    }
                }
                return(ExpelCrewman());
            }

            var evas = FlightGlobals.ActiveVessel.FindPartModulesImplementing <ModuleScienceExperiment>();

            for (int i = evas.Count - 1; i >= 0; i--)
            {
                ModuleScienceExperiment exp = evas[i];
                if (!exp.Deployed && exp.experimentID == experiment.id && !ExcludeFilters.IsExcluded(exp))
                {
                    //exp.DeployExperiment();
                    if (!(DMagicFactory.DMagic_IsInstalled && DMagicFactory.RunExperiment(experiment.id, exp)) &&
                        !(DMagicFactory.DMagicScienceAnimateGeneric_IsInstalled && DMagicFactory.RunSciAnimGenExperiment(experiment.id, exp)))
                    {
                        exp.DeployExperiment();
                    }
                    break;
                }
            }
            return(true);
        }
        private IEnumerator DoStart()
        {
            while (ResearchAndDevelopment.Instance == null)
            {
                yield return(0);
            }
            while (FlightGlobals.ActiveVessel == null)
            {
                yield return(0);
            }
            while (!FlightGlobals.ready)
            {
                yield return(0);
            }
            Instance = this;

            while (ScienceAlertProfileManager.Instance == null || !ScienceAlertProfileManager.Instance.Ready)
            {
                yield return(0);
            }

            try
            {
                ScienceExperiment experiment = ResearchAndDevelopment.GetExperiment("asteroidSample");
                if (experiment != null)
                {
                    experiment.experimentTitle = "Sample (Asteroid)";
                }
            }
            catch (KeyNotFoundException)
            {
                Destroy(this);
            }
            DMagicFactory.InitDMagicFactory();


            gameObject.AddComponent <AudioPlayer>().LoadSoundsFrom(ConfigUtil.GetDllDirectoryPath() + "/../sounds");
            gameObject.AddComponent <BiomeFilter>();
            gameObject.AddComponent <ExperimentManager>();
            gameObject.AddComponent <WindowEventLogic>();
            excludeFilters    = new ExcludeFilters();
            ScanInterfaceType = Settings.Instance.ScanInterfaceType;

            SliceAtlasTexture();
            CreateButton();
        }