From 6048d7c9af9a59211447fbd43d93c7571992812a Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 23 Jun 2023 13:12:30 -0700 Subject: [PATCH] Add back the Ascent AP Toggle not sure why i deleted that, but it did have to change because of the restructuring of the ascent autopilots. Signed-off-by: Lamont Granquist --- MechJeb2/MechJebCore.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/MechJeb2/MechJebCore.cs b/MechJeb2/MechJebCore.cs index fd70ce84..f2e7c643 100644 --- a/MechJeb2/MechJebCore.cs +++ b/MechJeb2/MechJebCore.cs @@ -280,6 +280,23 @@ public void OnTranslatronToggleHSAction(KSPActionParam param) } } + [KSPAction("#MechJeb_AscentAPtoggle")] //Ascent AP toggle + public void OnAscentAPToggleAction(KSPActionParam param) + { + MechJebCore masterMechJeb = vessel.GetMasterMechJeb(); + + MechJebModuleAscentBaseAutopilot autopilot = masterMechJeb.AscentSettings.AscentAutopilot; + MechJebModuleAscentMenu ascentMenu = GetComputerModule(); + + if (autopilot == null || ascentMenu == null) + return; + + if (autopilot.Enabled) + autopilot.aUsers.Remove(ascentMenu); + else + autopilot.Users.Add(ascentMenu); + } + private void EngageTranslatronControl(MechJebModuleThrustController.TMode mode) { MechJebCore masterMechJeb = vessel.GetMasterMechJeb();