Add some safety checks for the minimap so you can't get softlocked
This commit is contained in:
parent
1f1bd5e300
commit
1c376b051a
1 changed files with 42 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue