//=============================================================================
// MovePlayerLikeDnf.js
// ----------------------------------------------------------------------------
// Version
// 1.0.0 2025/11/01 初版
//=============================================================================
var Imported = Imported || {};
Imported.KN_MovePlayerLikeDnf = true;
var KN = KN || {};
KN.MPLD = KN.MPLD || {};
KN.MPLD.version = 1.00;
KN.MPLD.pluginName = document.currentScript.src.match(/([^\/]+)\.js/)[1];
/*:
* @plugindesc 人物的移动方式会像DNF那样子
* @target MZ
* @url [url]https://rpg.blue/thread-498236-1-1.html[/url]
* @author 佚名
*
* @param InitDirectionMPLD
* @text 初始朝向
* @desc 第一次进行游戏时, 玩家面朝的方向
* @default 2
* @type number
*
* @param SwitchDisableMPLD
* @text 停用开关
* @desc 开关打开时, 此插件的功能就会暂停运作
* @default 0
* @type switch
*
* @help MovePlayerLikeDnf.js
* 左行后上下是左方向图,切换右行后,上下就显示右方向图~
*/
//=============================================================================
// Parameter Variables
//=============================================================================
KN.Parameters = PluginManager.parameters(KN.MPLD.pluginName);
KN.Param = KN.Param || {};
KN.Param.InitDirectionMPLD = parseInt(KN.Parameters['InitDirectionMPLD']);
KN.Param.SwitchDisableMPLD = KN.Parameters['SwitchDisableMPLD'];
const _alias_20251101_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function () {
_alias_20251101_Game_CharacterBase_initMembers.apply(this, arguments);
if (this instanceof Game_Player) {
this._previousDirection = this._direction = KN.Param.InitDirectionMPLD;
} else {
this._previousDirection = this._direction;
}
};
const _alias_20251101_Game_CharacterBase_setDirection = Game_CharacterBase.prototype.setDirection;
Game_CharacterBase.prototype.setDirection = function (d) {
if (!$gameSwitches.value(KN.Param.SwitchDisableMPLD)) {
const dir = this.direction();
if (dir > 2 && dir < 8) this._previousDirection = dir;
if (d === 2 || d === 8) {
if ([4, 6].contains(this._previousDirection)) {
d = this._previousDirection;
}
}
}
_alias_20251101_Game_CharacterBase_setDirection.call(this, d);
};