Skip to content

Commit

Permalink
1.21.1 (#892)
Browse files Browse the repository at this point in the history
## Bug fixes
- Fixed the hatchling just never opening their eyes ever again after
warping
  • Loading branch information
xen-42 committed Jun 11, 2024
2 parents 779178e + 4cb3b07 commit aca6ee2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
18 changes: 7 additions & 11 deletions NewHorizons/Components/Ship/ShipWarpController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -144,6 +138,12 @@ public void Update()
resources._currentHealth = 100f;
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
Expand All @@ -154,11 +154,6 @@ public void Update()
}
}

private void OnFinishOpenEyes()
{
_eyesOpen = true;
}

private void StartWarpInEffect()
{
NHLogger.LogVerbose("Starting warp-in effect");
Expand Down Expand Up @@ -203,6 +198,7 @@ public void FinishWarpIn()
PlayerState.OnEnterShip();

PlayerSpawnHandler.SpawnShip();
OWInput.ChangeInputMode(InputMode.ShipCockpit);
}
}
}
24 changes: 24 additions & 0 deletions NewHorizons/Patches/WarpPatches/InputManagerPatches.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
2 changes: 1 addition & 1 deletion NewHorizons/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" ],
Expand Down

0 comments on commit aca6ee2

Please sign in to comment.