Improve handling of variant data overrides for mixed animated mode

pull/326/head
Flashfyre 2024-04-27 18:06:41 -04:00
parent 55f68c0ce6
commit 854de76467
1 changed files with 17 additions and 4 deletions

View File

@ -531,10 +531,23 @@ export default class BattleScene extends SceneBase {
.then(v => { .then(v => {
Object.keys(v).forEach(k => variantData[k] = v[k]); Object.keys(v).forEach(k => variantData[k] = v[k]);
if (this.experimentalSprites) { if (this.experimentalSprites) {
const expTree = variantData['exp']; const expVariantData = variantData['exp'];
Object.keys(expTree).forEach(ek => { const traverseVariantData = (keys: string[]) => {
variantData[ek] = expTree[ek]; let variantTree = variantData;
let expTree = expVariantData;
keys.map((k: string, i: integer) => {
if (i < keys.length - 1) {
variantTree = variantTree[k];
expTree = expTree[k];
} else if (variantTree.hasOwnProperty(k) && expTree.hasOwnProperty(k)) {
if ([ 'back', 'female' ].includes(k))
traverseVariantData(keys.concat(k));
else
variantTree[k] = expTree[k];
}
}); });
};
Object.keys(expVariantData).forEach(ek => traverseVariantData([ ek ]));
} }
Promise.resolve(); Promise.resolve();
}); });