Exemple #1
0
 public override void OnStart(PartModule.StartState state)
 {
     if (HighLogic.LoadedSceneIsFlight)
     {
         drone = this.GetComponent <ModuleSAS>();
         if (drone != null)
         {
             baseSAS = drone.SASServiceLevel;
         }
     }
 }
        protected void checkForUpgrade()
        {
            if (ResearchAndDevelopment.Instance == null)
            {
                return;
            }
            ModuleSAS sasModule = this.part.FindModuleImplementing <ModuleSAS>();

            if (sasModule == null)
            {
                return;
            }
            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }
            if (upgradeChecked)
            {
                return;
            }

            upgradeChecked = true;

            if (ResearchAndDevelopment.GetTechnologyState(levelThreeNode) == RDTech.State.Available)
            {
                sasModule.SASServiceLevel = 3;
            }

            else if (ResearchAndDevelopment.GetTechnologyState(levelTwoNode) == RDTech.State.Available)
            {
                sasModule.SASServiceLevel = 2;
            }

            else if (ResearchAndDevelopment.GetTechnologyState(levelOneNode) == RDTech.State.Available)
            {
                sasModule.SASServiceLevel = 1;
            }

            else
            {
                sasModule.SASServiceLevel = 0;
            }

            sasModule.OnAwake();
            sasModule.OnActive();
        }
 private void SetSASServiceLevel()
 {
     if (SASServiceLevel >= 0)
     {
         if (sasModule == null)
         {
             sasModule = part.FindModuleImplementing <ModuleSAS>();
         }
         if (sasModule != null)
         {
             if (sasModule.SASServiceLevel != SASServiceLevel)
             {
                 sasModule.SASServiceLevel = SASServiceLevel;
                 Log("Setting SAS service level to ", SASServiceLevel);
             }
         }
     }
 }
Exemple #4
0
        protected void setupModules()
        {
            //Command
            ModuleCommand command = this.part.FindModuleImplementing <ModuleCommand>();

            if (command != null)
            {
                command.enabled   = groundOpsMode;
                command.isEnabled = groundOpsMode;
            }

            //Solar Panel
            ModuleDeployableSolarPanel solarPanel = this.part.FindModuleImplementing <ModuleDeployableSolarPanel>();

            if (solarPanel != null)
            {
                solarPanel.enabled   = groundOpsMode;
                solarPanel.isEnabled = groundOpsMode;
            }

            //Reaction Wheel
            ModuleReactionWheel reactionWheel = this.part.FindModuleImplementing <ModuleReactionWheel>();

            if (reactionWheel != null)
            {
                reactionWheel.enabled   = groundOpsMode;
                reactionWheel.isEnabled = groundOpsMode;
            }

            //SAS
            ModuleSAS sas = this.part.FindModuleImplementing <ModuleSAS>();

            if (sas != null)
            {
                sas.enabled   = groundOpsMode;
                sas.isEnabled = groundOpsMode;
            }
        }
        public override void OnStart(StartState state)
        {
            base.OnStart(state);

            if (HighLogic.LoadedSceneIsFlight == false)
            {
                return;
            }

            if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX)
            {
                ModuleSAS sasModule = this.part.FindModuleImplementing <ModuleSAS>();
                if (sasModule != null)
                {
                    sasModule.SASServiceLevel = 3;
                    sasModule.OnAwake();
                    sasModule.OnActive();
                }
                return;
            }

            //Check for upgrade
            checkForUpgrade();
        }
Exemple #6
0
 public override void OnStart(StartState state)
 {
     base.OnStart(state);
     moduleSAS     = this.part.FindModuleImplementing <ModuleSAS>();
     reactionWheel = this.part.FindModuleImplementing <ModuleReactionWheel>();
 }