public BSSAutopilot()
        {
            KSP_1_6_plus = BSSAddon.kspAtLeast(1, 6);

            // Backward compatibility for KSP < 1.6 by patching in 1.6+ API only where available
            if (KSP_1_6_plus)
            {
                BSSAddon.harmony.Patch(typeof(BSSAutopilotExtensions).GetMethod("EnableFullSASInSandbox", bf),
                                       prefix: new HarmonyMethod(typeof(BSSAutopilotExtensions_EnableFullSASInSandbox).GetMethod("Prefix", bf)));
                APSE_AALV_original = typeof(APSkillExtensions).GetMethod("AvailableAtLevel", new Type[] { typeof(VesselAutopilot.AutopilotMode), typeof(Vessel) });
                APSE_AALV_patch    = typeof(APSkillExtensions_AvailableAtLevel_vessel).GetMethod("Prefix", bf);
            }
            APSE_AALI_original = typeof(APSkillExtensions).GetMethod("AvailableAtLevel", new Type[] { typeof(VesselAutopilot.AutopilotMode), typeof(int) });
            APSE_AALI_patch    = typeof(APSkillExtensions_AvailableAtLevel_int).GetMethod("Prefix", bf);

            GameEvents.onLevelWasLoaded.Add(OnLevelWasLoaded);
            GameEvents.onGameStateCreated.Add(OnGameStateCreated);
            //GameEvents.onGameStateLoad.Add(OnGameStateLoad);
            GameEvents.onGameStatePostLoad.Add(OnGameStatePostLoad);
            GameEvents.OnGameSettingsApplied.Add(OnGameSettingsApplied);
        }
 private static void Log(string s, params object[] m)
 {
     BSSAddon.Log("Autopilot: " + s, m);
 }
Example #3
0
 private static void Log(string s, params object[] m)
 {
     BSSAddon.Log("Repair: " + s, m);
 }