Hi people!
I'm trying to understand how can I store custom data inside this file.
The reason is that I want a global object to be saved for different save files.
Well, somehow, I managed to do that!
I change the global object in-game and call ConfigManager.save(), then my global object is saved across different save files.
BUT!
The problem is, I can't understand how I do it and why it's working. I've tried to replicate the same pattern that Rpg Maker Mv code does to save the bgmVolume. And somehow managed to work. But I can't really understand why =/
Here is what I have:
So please, can you try to explain my code to me? 
I'm trying to understand how can I store custom data inside this file.
The reason is that I want a global object to be saved for different save files.
Well, somehow, I managed to do that!
I change the global object in-game and call ConfigManager.save(), then my global object is saved across different save files.
BUT!
The problem is, I can't understand how I do it and why it's working. I've tried to replicate the same pattern that Rpg Maker Mv code does to save the bgmVolume. And somehow managed to work. But I can't really understand why =/
Here is what I have:
JavaScript:
ConfigManager.casa = {
Stage0: null,
Stage1: [],
Stage2: [],
Stage3: [],
Stage4: [],
Stage5: [],
Stage6: []
}
Object.defineProperty(ConfigManager, 'casa', {
get: function() {
return casa;
},
set: function(value) {
casa = value;
},
configurable: true
});
var _ConfigManager_makeData = ConfigManager.makeData;
ConfigManager.makeData = function() {
let config = _ConfigManager_makeData.call(this);
config.casa = this.casa;
return config;
};
var _ConfigManager_applyData = ConfigManager.applyData;
ConfigManager.applyData = function(config) {
_ConfigManager_applyData.call(this,config);
this.casa = this.readCustom(config, 'casa');
};
ConfigManager.readCustom = function(config, name) {
var value = config[name];
if (value !== undefined) {
return config[name];
} else {
return {
Stage0: null,
Stage1: [],
Stage2: [],
Stage3: [],
Stage4: [],
Stage5: [],
Stage6: []
};
}
};

