var Imported = Imported || {};
Imported.KANNA_SPPMG = true;
/*:
* @plugindesc 测试时在地图中随意地设置主角的位置
* @author 康娜酱
*
* @help 1.注意,不能重命名这个js文件
* 2.功能正在运作时,可按鼠标右键关闭
* 3.仅在测试游戏时生效,即部署后失效
* 4.如有疑问,可加Q群632269521查询
*
* @param switchId
* @desc 启用效果的开关ID
* @default 1
*/
var parameters = PluginManager.parameters('SetPlayerPositionMidGame');
var switchId = Number(parameters['switchId'] || 1);
(function () {
var _Game_Temp_setDestination = Game_Temp.prototype.setDestination;
Game_Temp.prototype.setDestination = function (x, y) {
if ($gameSwitches.value(switchId)) return;
_Game_Temp_setDestination.call(this, x, y);
};
var _Scene_Map_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function () {
_Scene_Map_update.call(this);
if ($gameTemp.isPlaytest() && $gameSwitches.value(switchId)) {
if (TouchInput.isCancelled()) $gameSwitches.setValue(switchId, false);
if (this.isMapTouchOk() && TouchInput.isTriggered()) {
var tx = TouchInput.x;
var ty = TouchInput.y;
var tw = $gameMap.tileWidth();
var th = $gameMap.tileHeight();
var px = $gamePlayer.x;
var py = $gamePlayer.y;
var sx = $gameMap.adjustX(px) * tw;
var sy = $gameMap.adjustY(py) * th;
if (tx < sx) {
px -= Math.ceil((sx - tx) / tw);
} else if (tx > (sx + tw)) {
px += Math.floor((tx - sx) / th);
};
if (ty < sy) {
py -= Math.ceil((sy - ty) / tw);
} else if (ty > (sy + th)) {
py += Math.floor((ty - sy) / th);
};
$gamePlayer.locate(px, py);
};
};
};
var _Scene_Map_isMenuEnabled = Scene_Map.prototype.isMenuEnabled;
Scene_Map.prototype.isMenuEnabled = function () {
return _Scene_Map_isMenuEnabled.call(this) && !$gameSwitches.value(switchId);
};
}());
收起