/// <summary> /// Returns true when Force Roll is on, and the roll is set to 0. /// </summary> /// <returns></returns> public bool ButtonForceRoll0State() { MechJebCore activeJeb = vessel.GetMasterMechJeb(); if (activeJeb == null) { return(false); } MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>(); return(activeSmartass != null && activeSmartass.forceRol && (double)activeSmartass.rol == 0.0); }
public static void SAForcerollClear() { MechJebCore activejeb = krpcmj.GetJeb(); if (activejeb != null) { MechJebModuleSmartASS activeass = activejeb.GetComputerModule("MechJebModuleSmartASS") as MechJebModuleSmartASS; if (activeass != null) { activeass.forceRol = false; } } }
/// <summary> /// Returns true when Force Roll is on, and the roll is set to -90. /// </summary> /// <returns></returns> public bool ButtonForceRoll270State() { MechJebCore activeJeb = vessel.GetMasterMechJeb(); if (activeJeb == null) { return(false); } // MOARdV TODO: normalize values before testing. MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>(); return(activeSmartass != null && activeSmartass.forceRol && (double)activeSmartass.rol == -90.0); }
public static void SAForceroll(float rol) { MechJebCore activejeb = krpcmj.GetJeb(); if (activejeb != null) { MechJebModuleSmartASS activeass = activejeb.GetComputerModule("MechJebModuleSmartASS") as MechJebModuleSmartASS; if (activeass != null) { activeass.rol = rol; activeass.forceRol = true; } } }
private static bool ReturnTargetState(MechJebModuleSmartASS.Target action, Vessel ourVessel) { MechJebCore activeJeb = ourVessel.GetMasterMechJeb(); if (activeJeb == null) { return(false); } MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>(); if (activeSmartass == null) { return(false); } return(action == activeSmartass.target); }
// and these are the two functions that actually do the work. private static void EnactTargetAction(MechJebModuleSmartASS.Target action, Vessel ourVessel) { MechJebCore activeJeb = ourVessel.GetMasterMechJeb(); if (activeJeb == null) { return; } MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>(); if (activeSmartass == null) { return; } activeSmartass.target = action; activeSmartass.Engage(); }
/// <summary> /// Toggles SmartASS Force Roll mode. /// </summary> /// <param name="state"></param> public void ButtonForceRoll(bool state) { MechJebCore activeJeb = vessel.GetMasterMechJeb(); if (activeJeb == null) { return; } MechJebModuleSmartASS activeSmartass = activeJeb.GetComputerModule <MechJebModuleSmartASS>(); if (activeSmartass != null) { activeSmartass.forceRol = state; activeSmartass.Engage(); } }
public static void SASurface(float hdg, float pit, float rol) { MechJebCore activejeb = krpcmj.GetJeb(); if (activejeb != null) { MechJebModuleSmartASS activeass = activejeb.GetComputerModule("MechJebModuleSmartASS") as MechJebModuleSmartASS; if (activeass != null) { activeass.mode = MechJebModuleSmartASS.Mode.SURFACE; activeass.srfHdg = hdg; activeass.srfPit = pit; activeass.srfRol = rol; activeass.target = MechJebModuleSmartASS.Target.SURFACE; activeass.Engage(); } } }
/* Note to self: * foreach (ThatEnumType item in (ThatEnumType[]) Enum.GetValues(typeof(ThatEnumType))) * can save a lot of time here. */ private void UpdateJebReferences() { activeJeb = vessel.GetMasterMechJeb(); // Node executor is activeJeb.node activeSmartass = activeJeb != null?activeJeb.GetComputerModule <MechJebModuleSmartASS>() : null; }