From 1c376b051a88db700c19bd83ea96e0d156cffe70 Mon Sep 17 00:00:00 2001 From: dazedanon Date: Sat, 20 Dec 2025 12:40:33 -0600 Subject: [PATCH] Add some safety checks for the minimap so you can't get softlocked --- js/plugins/MinimapZoom.js | 45 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/js/plugins/MinimapZoom.js b/js/plugins/MinimapZoom.js index 66a9d89..dc7ead8 100644 --- a/js/plugins/MinimapZoom.js +++ b/js/plugins/MinimapZoom.js @@ -28,12 +28,38 @@ // Track minimap state let minimapActive = false; + // Export minimap state for other plugins/systems to check + window.isMinimapActive = function() { + return minimapActive; + }; + + // Function to close minimap from anywhere (used by event start) + window.closeMinimapIfActive = function() { + if (minimapActive && SceneManager._scene && SceneManager._scene.hideMinimap) { + minimapActive = false; + SceneManager._scene.hideMinimap(); + SoundManager.playCancel(); + } + }; + //========================================================================= // Input - Add minimap key //========================================================================= Input.keyMapper[toggleKeyCode] = 'minimap'; + //========================================================================= + // Auto-close minimap when any event starts + //========================================================================= + + // When any event starts, auto-close the minimap + const _Game_Event_start = Game_Event.prototype.start; + Game_Event.prototype.start = function() { + // Close minimap if it's open when an event tries to start + window.closeMinimapIfActive(); + _Game_Event_start.call(this); + }; + //========================================================================= // Scene_Map - Handle minimap toggle //========================================================================= @@ -45,9 +71,22 @@ }; Scene_Map.prototype.updateMinimapToggle = function() { - // Only allow toggle when not busy with messages/menus - if (Input.isTriggered('minimap') && !$gameMessage.isBusy()) { - this.toggleMinimap(); + // Allow closing minimap anytime (even during events/messages), but only open when not busy + if (Input.isTriggered('minimap')) { + if (minimapActive) { + // Always allow closing + this.toggleMinimap(); + } else if (!$gameMessage.isBusy() && !$gameMap.isEventRunning()) { + // Only open when not busy + this.toggleMinimap(); + } + } + + // Auto-close minimap if an event starts running or message appears + if (minimapActive && ($gameMap.isEventRunning() || $gameMessage.isBusy())) { + minimapActive = false; + this.hideMinimap(); + SoundManager.playCancel(); } // Update player marker position and atmospheric effects if minimap is active