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 => {
Object.keys(v).forEach(k => variantData[k] = v[k]);
if (this.experimentalSprites) {
const expTree = variantData['exp'];
Object.keys(expTree).forEach(ek => {
variantData[ek] = expTree[ek];
});
const expVariantData = variantData['exp'];
const traverseVariantData = (keys: string[]) => {
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();
});