public MechJebModuleScriptActionAscent(MechJebModuleScript scriptModule, MechJebCore core) : base(scriptModule, core, NAME) { this.autopilot = core.GetComputerModule <MechJebModuleAscentAutopilot>(); this.ascentModule = core.GetComputerModule <MechJebModuleAscentGuidance>(); this.mainBody = core.target.mainBody; this.targetOrbit = core.target.TargetOrbit; actionTypes.Add("Ascent Guidance"); actionTypes.Add("Launching to Rendezvous"); this.readModuleConfiguration(); }
[KSPAction("#MechJeb_AscentAPtoggle")]//Ascent AP toggle public void OnAscentAPToggleAction(KSPActionParam param) { MechJebModuleAscentAutopilot autopilot = GetComputerModule <MechJebModuleAscentAutopilot>(); MechJebModuleAscentGuidance ascentGuidance = GetComputerModule <MechJebModuleAscentGuidance>(); if (autopilot == null || ascentGuidance == null) { return; } if (autopilot.enabled) { autopilot.users.Remove(ascentGuidance); } else { autopilot.users.Add(ascentGuidance); } }