Put in option to turn it off

This commit is contained in:
dazedanon 2025-12-21 12:16:12 -06:00
parent dc2d041a5f
commit a5eda61eed

View file

@ -25,6 +25,11 @@
* - Exit locations are numbered and show destination names in a legend
* - Nearby exits to the same location are grouped together
* - Zoom and pan for easier viewing of large maps
* - Fog of War: Only explored areas are revealed on the minimap
* - Exit Discovery: Exits are only shown after the player uses them
*
* Settings:
* - Can be enabled/disabled from the Options menu ("Minimap/Cartograph")
*/
(function() {
@ -74,6 +79,38 @@
}
};
//=========================================================================
// ConfigManager - Add minimap enabled setting
//=========================================================================
// Default value (enabled by default)
ConfigManager.minimapEnabled = true;
// Hook into makeData to save the setting
const _ConfigManager_makeData = ConfigManager.makeData;
ConfigManager.makeData = function() {
const config = _ConfigManager_makeData.call(this);
config.minimapEnabled = this.minimapEnabled;
return config;
};
// Hook into applyData to load the setting
const _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
_ConfigManager_applyData.call(this, config);
this.minimapEnabled = this.readFlag(config, "minimapEnabled", true);
};
//=========================================================================
// Window_Options - Add minimap toggle option
//=========================================================================
const _Window_Options_makeCommandList = Window_Options.prototype.makeCommandList;
Window_Options.prototype.makeCommandList = function() {
_Window_Options_makeCommandList.call(this);
this.addCommand("Minimap (Mod)", "minimapEnabled");
};
//=========================================================================
// Input - Add minimap key and zoom/pan keys
//=========================================================================
@ -250,6 +287,16 @@
};
Scene_Map.prototype.updateMinimapToggle = function() {
// Check if minimap is enabled in options
if (!ConfigManager.minimapEnabled) {
// If minimap is currently active but disabled, close it
if (minimapActive) {
minimapActive = false;
this.hideMinimap();
}
return; // Don't process minimap inputs when disabled
}
// Allow closing minimap anytime (even during events/messages), but only open when not busy
if (Input.isTriggered('minimap')) {
if (minimapActive) {