Class in reactor_managers.js

DataManager

55 functions in 6 groups · hide internal

The Database: everything Core loads at boot.

Familiar territory. DataManager keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.

Quick Reference

Setup & Creation 16

loadGlobalInfo() Loads the global info.
loadDatabase() Loads the database.
loadDataFile() Loads the data file.
loadMapData() Loads the map data.
loadMapSidecar() Fetch a 3D map's sidecar, if it declares itself one.
makeEmptyMap() Makes the empty map.
createGameObjects() Creates the game objects.
setupNewGame() Setup new game.
setupBattleTest() Setup battle test.
setupEventTest() Setup event test.
loadAllSavefileImages() Loads the all savefile images.
loadSavefileImages() Loads the savefile images.
loadGame() Loads the game.
makeSavename() Makes the savename.
makeSavefileInfo() Makes the savefile info.
makeSaveContents() Makes the save contents.

Getting Information 1

maxSavefiles() The maximum savefiles.

Checks (True / False) 14

isGlobalInfoLoaded() Whether it is global info loaded.
isDatabaseLoaded() Whether it is database loaded.
isMapLoaded() Whether it is map loaded.
isMapObject() Whether it is map object.
isBattleTest() Whether it is battle test.
isEventTest() Whether it is event test.
isTitleSkip() Whether it is title skip.
isSkill() Whether it is skill.
isItem() Whether it is item.
isWeapon() Whether it is weapon.
isArmor() Whether it is armor.
isAnySavefileExists() Whether it is any savefile exists.
isPlaytestCheckpointEnabled() Whether it is playtest checkpoint enabled.
hasPlaytestCheckpoint() Whether it has the playtest checkpoint.

Actions 7

removeInvalidGlobalInfo() Removes the invalid global info.
removeHiddenGlobalInfo() The playtest checkpoint is not a save the player made.
saveGlobalInfo() Saves the global info.
savePlaytestCheckpoint() Saves the checkpoint, unless one is being written or the party is dead.
saveGame() Saves the game.
selectSavefileForNewGame() Selects the savefile for new game.
swapReferences() Every writable reference reachable from roots to a key of swaps replaced by its value (data fields only; acce…

Events, Commands & Input 3

onXhrLoad() Called when xhr load happens.
onXhrError() Called when xhr error happens.
onLoad() Called when load happens.

Other 14

_checkStalledDataFiles() A data XHR can die without firing onload OR onerror, leaving isDatabaseLoaded()/isMapLoaded() false forever —…
bridgeStateDescriptions() Bridge state descriptions.
extractArrayMetadata() Extract array metadata.
extractMetadata() Extract metadata.
checkError() Check error.
latestSavefileId() Latest savefile id.
earliestSavefileId() Earliest savefile id.
emptySavefileId() Empty savefile id.
savefileInfo() Savefile info.
playtestCheckpointId() The checkpoint to resume: the named file, else one left in slot 99 by an earlier build; null with neither.
savefileExists() Savefile exists.
extractSaveContents() Extract save contents.
evenCharacterShapes() The restored characters rebuilt in one shape per kind (Game_CharacterBase.evenOut), and every reference to on…
correctDataErrors() Correct data errors.

Setup & Creation

loadGlobalInfo

static source
DataManager.loadGlobalInfo()

Loads the global info. (Same as the RPG Maker MZ method of this name.)

loadDatabase

static source
DataManager.loadDatabase()

Loads the database. (Same as the RPG Maker MZ method of this name.)

loadDataFile

static source
DataManager.loadDataFile(name, src)

Loads the data file. (Same as the RPG Maker MZ method of this name.)

loadMapData

static source
DataManager.loadMapData(mapId)

Loads the map data. (Same as the RPG Maker MZ method of this name.)

loadMapSidecar

static source
DataManager.loadMapSidecar(mapData)

Fetch a 3D map's sidecar, if it declares itself one.

Details

Fetch a 3D map's sidecar, if it declares itself one.

The map note is the switch and the sidecar is the data: only a map carrying <3d> is asked for one, so a project with no 3D maps issues no extra requests and pays nothing for the feature. A missing or unreadable sidecar is not an error — the map renders flat at elevation 0, which is exactly the state an existing 2D map is in before any elevation has been painted.

makeEmptyMap

static source
DataManager.makeEmptyMap()

Makes the empty map. (Same as the RPG Maker MZ method of this name.)

createGameObjects

static source
DataManager.createGameObjects()

Creates the game objects. (Same as the RPG Maker MZ method of this name.)

setupNewGame

static source
DataManager.setupNewGame()

Setup new game. (Same as the RPG Maker MZ method of this name.)

setupBattleTest

static source
DataManager.setupBattleTest()

Setup battle test. (Same as the RPG Maker MZ method of this name.)

setupEventTest

static source
DataManager.setupEventTest()

Setup event test. (Same as the RPG Maker MZ method of this name.)

loadAllSavefileImages

static source
DataManager.loadAllSavefileImages()

Loads the all savefile images. (Same as the RPG Maker MZ method of this name.)

loadSavefileImages

static source
DataManager.loadSavefileImages(info)

Loads the savefile images. (Same as the RPG Maker MZ method of this name.)

loadGame

static source
DataManager.loadGame(savefileId)

Loads the game. (Same as the RPG Maker MZ method of this name.)

makeSavename

static source
DataManager.makeSavename(savefileId)

Makes the savename. (Same as the RPG Maker MZ method of this name.)

makeSavefileInfo

static source
DataManager.makeSavefileInfo()

Makes the savefile info. (Same as the RPG Maker MZ method of this name.)

makeSaveContents

static source
DataManager.makeSaveContents()

Makes the save contents. (Same as the RPG Maker MZ method of this name.)

Getting Information

maxSavefiles

static source
DataManager.maxSavefiles()

The maximum savefiles. (Same as the RPG Maker MZ method of this name.)

Checks (True / False)

isGlobalInfoLoaded

static source
DataManager.isGlobalInfoLoaded()

Whether it is global info loaded. (Same as the RPG Maker MZ method of this name.)

isDatabaseLoaded

static source
DataManager.isDatabaseLoaded()

Whether it is database loaded. (Same as the RPG Maker MZ method of this name.)

isMapLoaded

static source
DataManager.isMapLoaded()

Whether it is map loaded. (Same as the RPG Maker MZ method of this name.)

isMapObject

static source
DataManager.isMapObject(object)

Whether it is map object. (Same as the RPG Maker MZ method of this name.)

isBattleTest

static source
DataManager.isBattleTest()

Whether it is battle test. (Same as the RPG Maker MZ method of this name.)

isEventTest

static source
DataManager.isEventTest()

Whether it is event test. (Same as the RPG Maker MZ method of this name.)

isTitleSkip

static source
DataManager.isTitleSkip()

Whether it is title skip. (Same as the RPG Maker MZ method of this name.)

isSkill

static source
DataManager.isSkill(item)

Whether it is skill. (Same as the RPG Maker MZ method of this name.)

isItem

static source
DataManager.isItem(item)

Whether it is item. (Same as the RPG Maker MZ method of this name.)

isWeapon

static source
DataManager.isWeapon(item)

Whether it is weapon. (Same as the RPG Maker MZ method of this name.)

isArmor

static source
DataManager.isArmor(item)

Whether it is armor. (Same as the RPG Maker MZ method of this name.)

isAnySavefileExists

static source
DataManager.isAnySavefileExists()

Whether it is any savefile exists. (Same as the RPG Maker MZ method of this name.)

isPlaytestCheckpointEnabled

static source
DataManager.isPlaytestCheckpointEnabled()

Whether it is playtest checkpoint enabled. (Same as the RPG Maker MZ method of this name.)

hasPlaytestCheckpoint

static source
DataManager.hasPlaytestCheckpoint()

Whether it has the playtest checkpoint. (Same as the RPG Maker MZ method of this name.)

Actions

removeInvalidGlobalInfo

static source
DataManager.removeInvalidGlobalInfo()

Removes the invalid global info. (Same as the RPG Maker MZ method of this name.)

removeHiddenGlobalInfo

static source
DataManager.removeHiddenGlobalInfo()

The playtest checkpoint is not a save the player made.

Details

The playtest checkpoint is not a save the player made. Its file is written, its entry never stays in the save list, so no list, newest-save lookup or Continue (the engine's or a plugin's) can land on it.

saveGlobalInfo

static source
DataManager.saveGlobalInfo(info)

Saves the global info. (Same as the RPG Maker MZ method of this name.)

savePlaytestCheckpoint

static source
DataManager.savePlaytestCheckpoint(reason)

Saves the checkpoint, unless one is being written or the party is dead.

saveGame

static source
DataManager.saveGame(savefileId)

Saves the game. (Same as the RPG Maker MZ method of this name.)

selectSavefileForNewGame

static source
DataManager.selectSavefileForNewGame()

Selects the savefile for new game. (Same as the RPG Maker MZ method of this name.)

swapReferences

static source
DataManager.swapReferences(roots, swaps)

Every writable reference reachable from roots to a key of swaps replaced by its value (data fields only; accessors are not read).

Events, Commands & Input

onXhrLoad

static source
DataManager.onXhrLoad(xhr, name, src, url)

Called when xhr load happens. (Same as the RPG Maker MZ method of this name.)

onXhrError

static source
DataManager.onXhrError(name, src, url)

Called when xhr error happens. (Same as the RPG Maker MZ method of this name.)

onLoad

static source
DataManager.onLoad(object)

Called when load happens. (Same as the RPG Maker MZ method of this name.)

Other

_checkStalledDataFiles

static internal source
DataManager._checkStalledDataFiles()

A data XHR can die without firing onload OR onerror, leaving isDatabaseLoaded()/isMapLoaded() false forever — a hung boot or map transfer with zero errors.

Details

A data XHR can die without firing onload OR onerror, leaving isDatabaseLoaded()/isMapLoaded() false forever — a hung boot or map transfer with zero errors. Driven by those polled gates, and fully self-sufficient (no hooks in loadDataFile — plugins like YEP_X_CoreUpdatesOpt replace that method wholesale): derive what is missing from _databaseFiles/$dataMap, time it, and re-fire whatever loadDataFile implementation is live. 10s of no arrival -> retry, for as long as it takes (see below: a missing file takes the error path by itself).

bridgeStateDescriptions

static source
DataManager.bridgeStateDescriptions(states)

Bridge state descriptions. (Same as the RPG Maker MZ method of this name.)

extractArrayMetadata

static source
DataManager.extractArrayMetadata(array)

Extract array metadata. (Same as the RPG Maker MZ method of this name.)

extractMetadata

static source
DataManager.extractMetadata(data)

Extract metadata. (Same as the RPG Maker MZ method of this name.)

checkError

static source
DataManager.checkError()

Check error. (Same as the RPG Maker MZ method of this name.)

latestSavefileId

static source
DataManager.latestSavefileId()

Latest savefile id. (Same as the RPG Maker MZ method of this name.)

earliestSavefileId

static source
DataManager.earliestSavefileId()

Earliest savefile id. (Same as the RPG Maker MZ method of this name.)

emptySavefileId

static source
DataManager.emptySavefileId()

Empty savefile id. (Same as the RPG Maker MZ method of this name.)

savefileInfo

static source
DataManager.savefileInfo(savefileId)

Savefile info. (Same as the RPG Maker MZ method of this name.)

playtestCheckpointId

static source
DataManager.playtestCheckpointId()

The checkpoint to resume: the named file, else one left in slot 99 by an earlier build; null with neither.

savefileExists

static source
DataManager.savefileExists(savefileId)

Savefile exists. (Same as the RPG Maker MZ method of this name.)

extractSaveContents

static source
DataManager.extractSaveContents(contents)

Extract save contents. (Same as the RPG Maker MZ method of this name.)

evenCharacterShapes

static source
DataManager.evenCharacterShapes(contents)

The restored characters rebuilt in one shape per kind (Game_CharacterBase.evenOut), and every reference to one anywhere in the loaded game (contents, or the game objects when not given) moved to its rebuilt self: a save that keeps shared references (an interpreter waiting on an event, a plugin's list of characters) plays on the same objects.

correctDataErrors

static source
DataManager.correctDataErrors()

Correct data errors. (Same as the RPG Maker MZ method of this name.)