From c12939b5bd49a74e8aec3e5d083c998a523c2deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Garro?= Date: Fri, 27 May 2022 04:11:59 -0300 Subject: [PATCH] Hide warp prompt in landing cam --- .../Components/ShipLogStarChartMode.cs | 41 +------------------ NewHorizons/Patches/WarpDrivePatches.cs | 1 + 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/NewHorizons/Components/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLogStarChartMode.cs index 251ce350..c23643e9 100644 --- a/NewHorizons/Components/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLogStarChartMode.cs @@ -31,7 +31,6 @@ namespace NewHorizons.Components private NotificationData _warpNotificationData = null; private int _nextCardIndex; - private bool _isAtFlightConsole; private void Awake() { @@ -51,10 +50,6 @@ namespace NewHorizons.Components _targetSystemPrompt = new ScreenPrompt(InputLibrary.markEntryOnHUD, "Lock Autopilot to Star System", 0, ScreenPrompt.DisplayState.Normal, false); GlobalMessenger.AddListener("TargetReferenceFrame", new Callback(OnTargetReferenceFrame)); - GlobalMessenger.AddListener("EnterFlightConsole", new Callback(OnEnterFlightConsole)); - GlobalMessenger.AddListener("ExitFlightConsole", new Callback(OnExitFlightConsole)); - GlobalMessenger.AddListener("GamePaused", new Callback(OnGamePaused)); - GlobalMessenger.AddListener("GameUnpaused", new Callback(OnGameUnpaused)); _nextCardIndex = 0; foreach (var starSystem in Main.SystemDict.Keys) @@ -96,42 +91,10 @@ namespace NewHorizons.Components public void OnDestroy() { GlobalMessenger.RemoveListener("TargetReferenceFrame", new Callback(OnTargetReferenceFrame)); - GlobalMessenger.RemoveListener("EnterFlightConsole", new Callback(OnEnterFlightConsole)); - GlobalMessenger.RemoveListener("ExitFlightConsole", new Callback(OnExitFlightConsole)); - GlobalMessenger.RemoveListener("GamePaused", new Callback(OnGamePaused)); - GlobalMessenger.RemoveListener("GameUnpaused", new Callback(OnGameUnpaused)); Locator.GetPromptManager().RemoveScreenPrompt(_warpPrompt, PromptPosition.UpperLeft); } - private void OnEnterFlightConsole(OWRigidbody _) - { - _isAtFlightConsole = true; - if (_target != null) - { - _warpPrompt.SetVisibility(true); - } - } - - private void OnExitFlightConsole() - { - _isAtFlightConsole = false; - _warpPrompt.SetVisibility(false); - } - - private void OnGamePaused() - { - _warpPrompt.SetVisibility(false); - } - - private void OnGameUnpaused() - { - if (_target != null && _isAtFlightConsole) - { - _warpPrompt.SetVisibility(true); - } - } - public GameObject CreateCard(string uniqueID, Transform parent, Vector2 position) { if (_cardTemplate == null) @@ -329,8 +292,6 @@ namespace NewHorizons.Components if (playSound) _oneShotSource.PlayOneShot(global::AudioType.ShipLogMarkLocation, 1f); _target.SetMarkedOnHUD(false); _target = null; - - _warpPrompt.SetVisibility(false); } public string GetTargetStarSystem() @@ -343,7 +304,7 @@ namespace NewHorizons.Components return OWInput.IsInputMode(InputMode.ShipCockpit) && _target != null; } - private void Update() + public void UpdateWarpPromptVisibility() { _warpPrompt.SetVisibility(IsWarpDriveAvailable()); } diff --git a/NewHorizons/Patches/WarpDrivePatches.cs b/NewHorizons/Patches/WarpDrivePatches.cs index ff5aec3a..ac7e6f92 100644 --- a/NewHorizons/Patches/WarpDrivePatches.cs +++ b/NewHorizons/Patches/WarpDrivePatches.cs @@ -24,6 +24,7 @@ namespace NewHorizons.Patches { if (!Main.HasWarpDrive) return true; + StarChartHandler.ShipLogStarChartMode.UpdateWarpPromptVisibility(); if (__instance._playerAtFlightConsole && OWInput.IsNewlyPressed(InputLibrary.autopilot, InputMode.ShipCockpit)) { var targetSystem = StarChartHandler.ShipLogStarChartMode.GetTargetStarSystem();