UNPKG

jams_mapper

Version:

A RPG Maker MZ plugin that allows you to load maps while walking rather than warping.

53 lines (48 loc) 2.12 kB
//Initialize Map Sectors $leftSector = null; $rightSector = null; $upperSector = null; $lowerSector = null; $upperLeftSector = null; $upperRightSector = null; $lowerLeftSector = null; $lowerRightSector = null; //this smooths out the gameplay, but I need to disable it, and handle the load balancing within my part of the application to avoid issues. var JAMS_isMapLoaded = DataManager.isMapLoaded; DataManager.isMapLoaded = function () { var b = JAMS_isMapLoaded.call(this) && !!Jams.Mapper.map && Jams.Mapper.map.isSectorAlignmentLoaded(); Jams?.Logger?.log("DataManager.isMapLoaded", { return: b }); return b; }; Game_Player.prototype._reserveTransfer = Game_Player.prototype.reserveTransfer; Game_Player.prototype.reserveTransfer = function (mapId, x, y, d, fadeType) { Jams?.Logger?.log("Game_Player.prototype.reserveTransfer", { mapId: mapId }, { x: x }, { y: y }, { d: d }, { fadeType: fadeType }); //perhaps I should just adjust the coordinates when loading the events instead of overriding this function. Jams.Mapper._transfer = true; x += $center.width; y += $center.width; this._reserveTransfer(mapId, x, y, d, fadeType); }; var Jams_isMapObject = DataManager.isMapObject; DataManager.isMapObject = function (object) { Jams?.Logger?.log("DataManager.isMapObject", { object: object }); if (Jams_isMapObject(object)) { Jams.Mapper.getNotes(object); return true; } return false; }; //Add src to object, so that we can add the notes to the world object. DataManager.JAMSonXhrLoad = DataManager.onXhrLoad; DataManager.onXhrLoad = function (xhr, name, src, url) { Jams?.Logger?.log(`DataManager.onXhrLoad`, { xhr: xhr }, { name: name }, { src: src }, { url: url }); if (xhr.status < 400) { obj = JSON.parse(xhr.responseText); obj.src = src; xhr = { status: xhr.status, responseText: JSON.stringify(obj) } } DataManager.JAMSonXhrLoad(xhr, name, src, url); if (name == "$dataMap") { Jams.Mapper.map = new Jams_Map($dataMap.src); } };