diff --git a/NewHorizons/Components/EOTE/NHSlideCollection.cs b/NewHorizons/Components/EOTE/NHSlideCollection.cs index 905187f7..6b13a833 100644 --- a/NewHorizons/Components/EOTE/NHSlideCollection.cs +++ b/NewHorizons/Components/EOTE/NHSlideCollection.cs @@ -158,6 +158,7 @@ public class NHSlideCollection : SlideCollection _pathsBeingLoaded.Remove(path); if (_shipLogSlideProjector == null) { + // Object.FindObjectOfType doesnt work with inactive _shipLogSlideProjector = Resources.FindObjectsOfTypeAll().FirstOrDefault(); } if (_shipLogSlideProjector != null) diff --git a/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs b/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs index 63986a2a..b0a0168d 100644 --- a/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs +++ b/NewHorizons/Patches/ToolPatches/ToolModeSwapperPatches.cs @@ -5,6 +5,8 @@ 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 @@ -21,7 +23,9 @@ namespace NewHorizons.Patches.ToolPatches mode == ToolMode.Probe || mode == ToolMode.SignalScope || mode == ToolMode.Translator; - var isInShip = UnityEngine.Object.FindObjectOfType()?._playerAtFlightConsole ?? false; + if (_shipCockpitController == null) + _shipCockpitController = UnityEngine.Object.FindObjectOfType(); + var isInShip = _shipCockpitController != null ? _shipCockpitController._playerAtFlightConsole : false; if (!isInShip && isHoldingVisionTorch && swappingToRestrictedTool) return false;