new-horizons/NewHorizons/Patches/WarpPatches/InputManagerPatches.cs
2024-06-10 23:12:19 -04:00

25 lines
796 B
C#

using HarmonyLib;
namespace NewHorizons.Patches.WarpPatches;
[HarmonyPatch(typeof(InputManager))]
public static class InputManagerPatches
{
[HarmonyPrefix]
[HarmonyPatch(nameof(InputManager.ChangeInputMode))]
public static bool InputManager_ChangeInputMode(InputManager __instance, InputMode mode)
{
// Can't use player state because it is updated after this method is called
var atFlightConsole = Locator.GetPlayerCameraController()?._shipController?.IsPlayerAtFlightConsole() ?? false;
// If we're flying the ship don't let it break our input by changing us to another input mode
if (atFlightConsole && mode == InputMode.Character)
{
return false;
}
else
{
return true;
}
}
}