@@ -849,7 +849,8 @@
id: id,
recipe: recipe,
batches: batches,
- amountProduced: batches * yieldAmt
+ amountProduced: batches * yieldAmt,
+ depth: depth
});
// 5. Produce Byproducts
@@ -939,6 +940,12 @@
}
});
+ // Sort by depth
+ merged.sort((a, b) => a.depth - b.depth);
+
+ // Reverse to get topological order (Dependencies first)
+ merged.reverse();
+
return merged;
}
}
@@ -1113,7 +1120,7 @@
const rIdx = selectedRecipes[node.id] !== undefined ? selectedRecipes[node.id] : 0;
const hasRecipe = recipeList.length > 0 && rIdx !== -1 && node.type !== 'surplus';
const currentRecipe = hasRecipe ? recipeList[rIdx] : null;
-
+ console.log(node.id, recipeList, rIdx, hasRecipe, currentRecipe);
let content = '';
if (node.type === 'surplus') {
content = `
[ FROM BYPRODUCTS ]
`;
@@ -1133,8 +1140,18 @@