diff options
Diffstat (limited to 'data/recipes/default.js')
| -rw-r--r-- | data/recipes/default.js | 39 | 
1 files changed, 39 insertions, 0 deletions
| diff --git a/data/recipes/default.js b/data/recipes/default.js index 20359a5e..1fcda5be 100644 --- a/data/recipes/default.js +++ b/data/recipes/default.js @@ -191,6 +191,45 @@ function combine(c, ...items) {      }      return result  } +// function combine(container, ...items) { +//     items.push(container) +//     const open = items.map(i => [i.name]) +//     const seen = new Set() +//     let final_result +//     let components_before +//     while ((components_before = open.pop())) { +//         for (const new_item of items) { +//             if (components_before.includes(new_item.name)) continue + +//             // generate key `old,old,old#new` to avoid duplicated recipes +//             const dedup_key = components_before.join(",") + "#" + new_item +//             if (seen.has(dedup_key)) continue +//             seen.add(dedup_key) + +//             if (new_item.container && !components_before.includes(container.name)) +//                 continue // new item is likely a liquid and needs target container to be there already + +//             const components_after = [...components_before, new_item.name] +//             components_after.sort() +//             open.push(components_after) + +//             const content_in = components_before.filter(e => e != container.name).join(",") +//             const item_in = content_in == "" ? container : new Item(content_in, components_before.includes(container.name) ? container : null) +//             const content_out = components_after.filter(e => e != container.name).join(",") +//             const item_out = content_out == "" ? container : new Item(content_out, components_after.includes(container.name) ? container : null) + +//             if (components_after.length == items.length) final_result = item_out +//             out({ +//                 action: "instant", +//                 inputs: [item_in, new_item], +//                 outputs: new_item == container // put result in containers positions if container was added +//                     ? [null, item_out] : [item_out, new_item.container] +//             }) +//         } +//     } +//     console.error(final_result); +//     return final_result +// }  function edible(...items) {      for (const i of items) {          out({ action: "demand", inputs: [i], outputs: [i.container?.dispose ?? i.container], duration: 10 }) | 
