This is psuedo fix to the incorrect resource usage when using multiple experiences.

This commit is contained in:
Chris Ryan 2025-09-04 17:46:02 +10:00
parent 3c893df175
commit 830c772c8b
2 changed files with 14 additions and 6 deletions

View file

@ -95,6 +95,14 @@ export default class CostField extends fields.ArrayField {
static getRealCosts(costs) {
const realCosts = costs?.length ? costs.filter(c => c.enabled) : [];
// Reset totals in case of repeat calls.
realCosts.forEach(c => {
c.scale = c.scale ?? 0;
c.step = c.step ?? 1;
c.total = c.value + c.scale * c.step;
});
let mergedCosts = [];
realCosts.forEach(c => {
const getCost = Object.values(mergedCosts).find(gc => gc.key === c.key);