From 841ee0a5df0db83b8c6b579538598e7b6cd3d157 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Fri, 14 Feb 2025 17:43:02 -0500 Subject: [PATCH] Just check player state --- NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs b/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs index b0a0168d..a9d1d1ca 100644 --- a/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs +++ b/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs @@ -5,8 +5,6 @@ namespace NewHorizons.Patches.ToolPatches [HarmonyPatch(typeof(ToolModeSwapper))] public static class ToolModeSwapperPatches { - private static ShipCockpitController _shipCockpitController; - // Patches ToolModeSwapper.EquipToolMode(ToolMode mode) to deny swaps if you're holding a vision torch. // This is critical for preventing swapping to the scout launcher (causes memory slides to fail) but it // just doesn't look right when you switch to other stuff (eg the signalscope), so I'm disabling swapping tools entirely @@ -23,11 +21,8 @@ namespace NewHorizons.Patches.ToolPatches mode == ToolMode.Probe || mode == ToolMode.SignalScope || mode == ToolMode.Translator; - if (_shipCockpitController == null) - _shipCockpitController = UnityEngine.Object.FindObjectOfType(); - var isInShip = _shipCockpitController != null ? _shipCockpitController._playerAtFlightConsole : false; - if (!isInShip && isHoldingVisionTorch && swappingToRestrictedTool) return false; + if (!PlayerState.AtFlightConsole() && isHoldingVisionTorch && swappingToRestrictedTool) return false; return true; }