Fix warp eyes

This commit is contained in:
Nick 2024-06-10 23:12:19 -04:00
parent 779178e493
commit f914f121f5
3 changed files with 33 additions and 12 deletions

View File

@ -47,12 +47,6 @@ namespace NewHorizons.Components.Ship
public void Start() public void Start()
{ {
_isWarpingIn = false; _isWarpingIn = false;
GlobalMessenger.AddListener("FinishOpenEyes", new Callback(OnFinishOpenEyes));
}
public void OnDestroy()
{
GlobalMessenger.RemoveListener("FinishOpenEyes", new Callback(OnFinishOpenEyes));
} }
private void MakeBlackHole() private void MakeBlackHole()
@ -144,6 +138,12 @@ namespace NewHorizons.Components.Ship
resources._currentHealth = 100f; resources._currentHealth = 100f;
if (!PlayerState.AtFlightConsole()) TeleportToShip(); if (!PlayerState.AtFlightConsole()) TeleportToShip();
} }
if (PlayerState.IsInsideShip() && !_eyesOpen)
{
_eyesOpen = true;
Locator.GetPlayerCamera().GetComponent<PlayerCameraEffectController>().OpenEyesImmediate();
}
} }
// Idk whats making this work but now it works and idc // Idk whats making this work but now it works and idc
@ -154,11 +154,6 @@ namespace NewHorizons.Components.Ship
} }
} }
private void OnFinishOpenEyes()
{
_eyesOpen = true;
}
private void StartWarpInEffect() private void StartWarpInEffect()
{ {
NHLogger.LogVerbose("Starting warp-in effect"); NHLogger.LogVerbose("Starting warp-in effect");
@ -203,6 +198,8 @@ namespace NewHorizons.Components.Ship
PlayerState.OnEnterShip(); PlayerState.OnEnterShip();
PlayerSpawnHandler.SpawnShip(); PlayerSpawnHandler.SpawnShip();
OWInput.ChangeInputMode(InputMode.ShipCockpit);
Delay.FireInNUpdates(() => OWInput.ChangeInputMode(InputMode.ShipCockpit), 10);
} }
} }
} }

View File

@ -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;
}
}
}

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends", "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Clay, Trifid, and friends",
"name": "New Horizons", "name": "New Horizons",
"uniqueName": "xen.NewHorizons", "uniqueName": "xen.NewHorizons",
"version": "1.21.0", "version": "1.21.1",
"owmlVersion": "2.12.1", "owmlVersion": "2.12.1",
"dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "PacificEngine.OW_CommonResources" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],