diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-07 20:24:38 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-07 20:24:44 +0200 |
commit | c4bc46e80a46d0fec3980ded73ae21eb9fa62f3e (patch) | |
tree | cda75bdec1da171ac843683129612804140a1f3d | |
parent | 7d43a12644a27bec2d4344f00bee79eddf888a77 (diff) | |
download | hurrycurry-c4bc46e80a46d0fec3980ded73ae21eb9fa62f3e.tar hurrycurry-c4bc46e80a46d0fec3980ded73ae21eb9fa62f3e.tar.bz2 hurrycurry-c4bc46e80a46d0fec3980ded73ae21eb9fa62f3e.tar.zst |
rename items to parsable format
-rw-r--r-- | data/recipes/default.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/data/recipes/default.ts b/data/recipes/default.ts index 14f306e0..085360b2 100644 --- a/data/recipes/default.ts +++ b/data/recipes/default.ts @@ -42,8 +42,8 @@ export function finish() { const k = new Set<string>() for (const r of all_recipes) { let s = `- action: !${r.action}\n` - s += ` inputs: [${r.inputs.map(e => e!.toString()).join(",")}]\n` - s += ` outputs: [${r.outputs.map(e => e!.toString()).join(",")}]\n` + s += ` inputs: [${r.inputs.map(e => JSON.stringify(e!.toString())).join(",")}]\n` + s += ` outputs: [${r.outputs.map(e => JSON.stringify(e!.toString())).join(",")}]\n` if (r.warn) s += ` warn: true\n` if (r.duration) s += ` duration: ${r.duration}\n` if (r.revert_duration) s += ` revert_duration: ${r.revert_duration}\n` @@ -83,7 +83,7 @@ class Item { return o } toString() { - return this.name + (this.container ? "-" + this.container : "") + return (this.container ? this.container + ":" : "") + this.name } } @@ -149,7 +149,7 @@ function combine(c: Container, ...items: Item[]): Item { if (!cur) break; for (const new_item of items) { if (cur.includes(new_item.name)) continue - const rkey = cur.join("-") + "#" + new_item + const rkey = cur.join(",") + "#" + new_item if (seen.has(rkey)) continue seen.add(rkey) @@ -157,8 +157,8 @@ function combine(c: Container, ...items: Item[]): Item { const parts = [...cur, new_item.name] parts.sort() open.push(parts) - const i = new Item(cur.join("-"), c) - const o = new Item(parts.join("-"), c) + const i = new Item(cur.join(","), c) + const o = new Item(parts.join(","), c) if (parts.length == items.length) result = o out({ action: "instant", @@ -243,8 +243,8 @@ edible(nigiri) const strawberry_puree = process(strawberry.tr(FP)).as("strawberry-puree") const milk = process(coconut.tr(FP)).as("milk") const strawberry_shake = either( - process(container_add(milk, strawberry).as("milk-strawberry")).as("strawberry-shake"), - process(container_add(strawberry_puree, coconut).as("coconut-strawberry-puree")).as("strawberry-shake") + process(container_add(milk, strawberry).as("milk,strawberry")).as("strawberry-shake"), + process(container_add(strawberry_puree, coconut).as("coconut,strawberry-puree")).as("strawberry-shake") ) // Icecream |