-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTF_DashControl.js
100 lines (95 loc) · 3.55 KB
/
TF_DashControl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//========================================
// TF_DashControl.js
// Version :1.0.0.0
// For : RPGツクールMZ (RPG Maker MZ)
// -----------------------------------------------
// Copyright : Tobishima-Factory 2018-2021
// Website : http://tonbi.jp
//
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
//========================================
/*:
* @target MZ
* @plugindesc ダッシュ状態をコマンドで切り替え
* @author とんび@鳶嶋工房(tonbi.jp)
* @url https://github.com/tonbijp/RPGMakerMZ/blob/master/TF_DashControl.js
* @base PluginCommonBase
* @orderAfter PluginCommonBase
*
* @param SHOW_MENU
* @text [オプション]に[常時ダッシュ]を表示するか
* @type boolean @default true
* @on 表示(規定値) @off 非表示
*
* @============ この長さに合わせるとヘルプではみ出ない ==============
* @help
* 標準ではダッシュの可・不可はマップごとでしか設定できません。
* このプラグインはコマンドでのダッシュ設定が可能です。
* 設定した状態はセーブされます。
*
* プラグインパラメータは次のものがあります。
* ・[オプション]に[常時ダッシュ]を表示するか]
*
* プラグインコマンドは次のものがあります。
* ・[ダッシュの許可]
*
* [スクリプト]から使う場合は
*
* $GameSystem.TF_isDdashEnabled = true; // ダッシュ可
* $GameSystem.TF_isDdashEnabled = false; // 歩きのみ
*
* [変数の操作]コマンドで[代入][スクリプト]を選び、以下のコードを入力
*
* $gameSystem.TF_dashEnabled?1:0
*
* これで、ダッシュ可:1, 歩きのみ: 0 の値が受け取れます。
*
* PluginCommonBase は本体付属の
* dlc/BasicResources/plugins/official/PluginCommonBase.js
* を使ってください。
*
* 利用規約 : MITライセンス
*
* @================================================
* @command DASH_ENABLED @text ダッシュの許可
* @desc ここで許可した場合も、
* マップで不可になっているとダッシュできません。
*
* @arg isDashEnabled @text ダッシュの許可
* @type boolean @default true
* @on ダッシュ可(規定値) @off 歩きのみ
*/
( () => {
"use strict";
const pluginParams = PluginManagerEx.createParameter( document.currentScript );
// [常時ダッシュ]メニューの表示・非表示の設定
if( !pluginParams.SHOW_MENU ) {
const _Window_Command_addCommand = Window_Command.prototype.addCommand;
Window_Options.prototype.addCommand = function( name, symbol, enabled, ext ) {
if( symbol === "alwaysDash" ) return;
_Window_Command_addCommand.apply( this, arguments );
};
}
/**
* Game_System初期化時にセーブ用変数を用意
*/
const _Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
_Game_System_initialize.call( this );
this.TF_isDdashEnabled = true;
};
/**
* プラグインコマンドの実行
*/
PluginManagerEx.registerCommand( document.currentScript, "DASH_ENABLED",
args => $gameSystem.TF_isDdashEnabled = args.isDashEnabled
);
/**
* @returns {Boolean} ダッシュ不可か
*/
const _Game_Map_isDashDisabled = Game_Map.prototype.isDashDisabled;
Game_Map.prototype.isDashDisabled = function() {
return !$gameSystem.TF_isDdashEnabled || _Game_Map_isDashDisabled.call( this );
};
} )();