magical-girls-runa-and-nanami/js/plugins/donot_move.js
2026-02-28 12:33:13 -06:00

40 lines
1.7 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*:
* @target MZ
* @plugindesc スイッチ34がONの間、プレイヤー移動とメニュー呼び出しを禁止 v1.1
* @author You
* @help
* スイッチ34がONのとき
* - 十字キー/アナログ/クリック等のプレイヤー移動を無効化
* - メニュー画面Esc/X/右クリック等)を開けなくする
* OFFで元に戻ります。イベントは通常どおり実行されます。
*/
(() => {
"use strict";
const BLOCK_SWITCH_ID = 34;
// 移動入力の抑制
const _Game_Player_moveByInput = Game_Player.prototype.moveByInput;
Game_Player.prototype.moveByInput = function() {
// イベント実行中でなく、ブロックスイッチがONなら移動入力を遮断
if (!$gameMap.isEventRunning() && $gameSwitches.value(BLOCK_SWITCH_ID)) {
return; // 何もしない(移動しない)
}
_Game_Player_moveByInput.call(this);
};
// メニュー呼び出しの抑制(どこからでも一貫して効くよう isMenuEnabled を拡張)
const _Game_System_isMenuEnabled = Game_System.prototype.isMenuEnabled;
Game_System.prototype.isMenuEnabled = function() {
// スイッチ34がONの間は常にメニュー無効他の無効化設定とも両立
if ($gameSwitches && $gameSwitches.value(BLOCK_SWITCH_ID)) return false;
return _Game_System_isMenuEnabled.call(this);
};
// 念のためマップシーンのメニュー呼び出し判定もガード(二重の安全策)
const _Scene_Map_isMenuCalled = Scene_Map.prototype.isMenuCalled;
Scene_Map.prototype.isMenuCalled = function() {
if ($gameSwitches.value(BLOCK_SWITCH_ID)) return false;
return _Scene_Map_isMenuCalled.call(this);
};
})();