diff --git a/NewHorizons/Components/Ship/ShipWarpController.cs b/NewHorizons/Components/Ship/ShipWarpController.cs index d1f8e62de..c9d4b8f59 100644 --- a/NewHorizons/Components/Ship/ShipWarpController.cs +++ b/NewHorizons/Components/Ship/ShipWarpController.cs @@ -47,12 +47,6 @@ public void Init() public void Start() { _isWarpingIn = false; - GlobalMessenger.AddListener("FinishOpenEyes", new Callback(OnFinishOpenEyes)); - } - - public void OnDestroy() - { - GlobalMessenger.RemoveListener("FinishOpenEyes", new Callback(OnFinishOpenEyes)); } private void MakeBlackHole() @@ -144,6 +138,12 @@ public void Update() resources._currentHealth = 100f; if (!PlayerState.AtFlightConsole()) TeleportToShip(); } + + if (PlayerState.IsInsideShip() && !_eyesOpen) + { + _eyesOpen = true; + Locator.GetPlayerCamera().GetComponent().OpenEyesImmediate(); + } } // Idk whats making this work but now it works and idc @@ -154,11 +154,6 @@ public void Update() } } - private void OnFinishOpenEyes() - { - _eyesOpen = true; - } - private void StartWarpInEffect() { NHLogger.LogVerbose("Starting warp-in effect"); @@ -203,6 +198,7 @@ public void FinishWarpIn() PlayerState.OnEnterShip(); PlayerSpawnHandler.SpawnShip(); + OWInput.ChangeInputMode(InputMode.ShipCockpit); } } } diff --git a/NewHorizons/Patches/WarpPatches/InputManagerPatches.cs b/NewHorizons/Patches/WarpPatches/InputManagerPatches.cs new file mode 100644 index 000000000..0a41f1687 --- /dev/null +++ b/NewHorizons/Patches/WarpPatches/InputManagerPatches.cs @@ -0,0 +1,24 @@ +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; + } + } +} diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index fd79e6fc3..205ce96a1 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.21.0", + "version": "1.21.1", "owmlVersion": "2.12.1", "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],