Kitten Space Agency mod to load real Artemis II orbit data
at main 30 lines 900 B view raw
1using HarmonyLib; 2using JetBrains.Annotations; 3using KSA; 4 5namespace OemLoader; 6 7[UsedImplicitly] 8[HarmonyPatch(typeof(Program))] 9internal static class ProgramPatch 10{ 11 // Don't allow the game to process keyboard inputs further if the text input in our window is focused 12 [UsedImplicitly] 13 [HarmonyPatch(nameof(Program.OnKey))] 14 [HarmonyPrefix] 15 private static bool OnKeyPrefix() 16 { 17 return !OemLoader.Instance?.Window.Typing ?? true; 18 } 19 20 // Since KSA build 4036 we need to draw our UI in the thread safe portion of the frame since we could be 21 // modifying vehicle state 22 // FIXME: when StarMap adds proper hooks into OnDrawUiThreadSafe, use that instead of this manual patch 23 [UsedImplicitly] 24 [HarmonyPatch("OnDrawUiThreadSafe")] 25 [HarmonyPostfix] 26 private static void AfterGuiThreadSafe() 27 { 28 OemLoader.Instance?.Window.Render(); 29 } 30}