Example #1
0
        protected internal override void InitInstance(object instance)
        {
            base.InitInstance(instance);
            this.guiInstance = MechJeb.GetComputerModule("AscentGuidance");

            this.desiredOrbitAltitude   = desiredOrbitAltitudeField.GetInstanceValue(instance);
            this.correctiveSteeringGain = correctiveSteeringGainField.GetInstanceValue(instance);
            this.verticalRoll           = verticalRollField.GetInstanceValue(instance);
            this.turnRoll = turnRollField.GetInstanceValue(instance);
            this.maxAoA   = maxAoAField.GetInstanceValue(instance);
            this.aoALimitFadeoutPressure = aoALimitFadeoutPressureField.GetInstanceValue(instance);
            this.launchPhaseAngle        = launchPhaseAngleField.GetInstanceValue(instance);
            this.launchLANDifference     = launchLANDifferenceField.GetInstanceValue(instance);
            this.warpCountDown           = warpCountDownField.GetInstanceValue(instance);

            this.AscentPathClassic.InitInstance(MechJeb.GetComputerModule("AscentClassic"));
            this.AscentPathGT.InitInstance(MechJeb.GetComputerModule("AscentGT"));
            this.AscentPathPVG.InitInstance(MechJeb.GetComputerModule("AscentPVG"));

            // Retrieve the current path index set in mechjeb and enable the path representing that index.
            // It fixes the issue with AscentAutopilot reporting empty status due to a disabled path.
            if (instance != null)
            {
                this.AscentPathIndex = this.AscentPathIndex;
            }
        }
Example #2
0
        public AscentAutopilot() : base("AscentAutopilot")
        {
            this.guiInstance = MechJeb.GetComputerModule("AscentGuidance");

            this.status                  = this.type.GetField("status");
            this.ascentPathIdx           = this.type.GetField("ascentPathIdx");
            this.desiredOrbitAltitude    = this.type.GetField("desiredOrbitAltitude").GetValue(this.instance);
            this.autoThrottle            = this.type.GetField("autoThrottle");
            this.correctiveSteering      = this.type.GetField("correctiveSteering");
            this.correctiveSteeringGain  = this.type.GetField("correctiveSteeringGain").GetValue(this.instance);
            this.forceRoll               = this.type.GetField("forceRoll");
            this.verticalRoll            = this.type.GetField("verticalRoll").GetValue(this.instance);
            this.turnRoll                = this.type.GetField("turnRoll").GetValue(this.instance);
            this.autodeploySolarPanels   = this.type.GetField("autodeploySolarPanels");
            this.autoDeployAntennas      = this.type.GetField("autoDeployAntennas");
            this.skipCircularization     = this.type.GetField("skipCircularization");
            this.autostage               = this.type.GetProperty("autostage");
            this.limitAoA                = this.type.GetField("limitAoA");
            this.maxAoA                  = this.type.GetField("maxAoA").GetValue(this.instance);
            this.aoALimitFadeoutPressure = this.type.GetField("aoALimitFadeoutPressure").GetValue(this.instance);
            this.launchPhaseAngle        = this.type.GetField("launchPhaseAngle").GetValue(this.instance);
            this.launchLANDifference     = this.type.GetField("launchLANDifference").GetValue(this.instance);
            this.warpCountDown           = this.type.GetField("warpCountDown").GetValue(this.instance);

            this.startCountdown = this.type.GetMethod("StartCountdown");

            this.AscentPathClassic = new AscentClassic();
            this.AscentPathGT      = new AscentGT();
            this.AscentPathPEG     = new AscentPEG();

            // Retrieve the current path index set in mechjeb and enable the path representing that index.
            // It fixes the issue with AscentAutopilot reporting empty status due to a disabled path.
            this.AscentPathIndex = this.AscentPathIndex;
        }
Example #3
0
 public void Start()
 {
     if (MechJeb.TypesLoaded)
     {
         Logger.Info("Initializing MechJeb instance...");
         Logger.Info(MechJeb.InitInstance() ? "KRPC.MechJeb is ready!" : "MechJeb found but the instance initialization wasn't successful. Maybe you don't have any MechJeb part attached to the vessel?");
     }
 }
Example #4
0
        public ComputerModule(string moduleType)
        {
            string fullModuleName = "MuMech.MechJebModule" + moduleType;

            AssemblyLoader.loadedAssemblies.TypeOperation(t => {
                if (t.FullName == fullModuleName)
                {
                    this.type = t;
                }
            });

            this.instance = MechJeb.GetComputerModule(moduleType);

            this.users = usersField.GetValue(this.instance);
        }
Example #5
0
 public void Start()
 {
     Logger.Info("Loading MechJeb types...");
     Logger.Info(MechJeb.InitTypes() ? "MechJeb found!" : "MechJeb is not available.");
 }