Fixed dependency graph not building correctly for resources consumed
This commit is contained in:
@@ -30,7 +30,6 @@ function dependOnCalc({dependencyGraph, prop, key}){
|
||||
let calc = get(prop, key);
|
||||
if (!calc) return;
|
||||
if (calc.type !== '_calculation'){
|
||||
console.log(calc);
|
||||
throw `Expected calculation got ${calc.type}`
|
||||
}
|
||||
dependencyGraph.addLink(prop._id, `${prop._id}.${key}`, 'calculation');
|
||||
@@ -63,7 +62,7 @@ function linkAction(dependencyGraph, prop, {propsById}){
|
||||
dependOnCalc({
|
||||
dependencyGraph,
|
||||
prop,
|
||||
key: `${prop._id}.resources.itemsConsumed.${index}.quantity`,
|
||||
key: `resources.itemsConsumed[${index}].quantity`,
|
||||
});
|
||||
});
|
||||
// Link attributes consumed
|
||||
@@ -74,7 +73,7 @@ function linkAction(dependencyGraph, prop, {propsById}){
|
||||
dependOnCalc({
|
||||
dependencyGraph,
|
||||
prop,
|
||||
key: `${prop._id}.resources.attributesConsumed.${index}.quantity`,
|
||||
key: `resources.attributesConsumed[${index}].quantity`,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,14 +11,13 @@ export default function computeCreature(creatureId){
|
||||
computeCreatureComputation(computation);
|
||||
writeAlteredProperties(computation);
|
||||
writeScope(creatureId, computation.scope);
|
||||
writeErrors(creatureId, computation.errors);
|
||||
} catch (e){
|
||||
computation.errors.push({
|
||||
type: 'crash',
|
||||
details: e.reason,
|
||||
});
|
||||
} finally {
|
||||
writeErrors(creatureId, [...computation.errors]);
|
||||
writeErrors(creatureId, computation.errors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user