aboutsummaryrefslogtreecommitdiff
path: root/data/recipes/default.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-13 23:27:18 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-13 23:27:18 +0200
commit0c77e0938de43a970e03c6dcef019c87745f0ee4 (patch)
tree76212988078d18edd59330061eeecb38b6ab7fc5 /data/recipes/default.ts
parentcd3a3989901d877426cbd64622b93367eaf81d4a (diff)
downloadhurrycurry-0c77e0938de43a970e03c6dcef019c87745f0ee4.tar
hurrycurry-0c77e0938de43a970e03c6dcef019c87745f0ee4.tar.bz2
hurrycurry-0c77e0938de43a970e03c6dcef019c87745f0ee4.tar.zst
automatically generate demands from map and recipes. added icecream and sushi.
Diffstat (limited to 'data/recipes/default.ts')
-rw-r--r--data/recipes/default.ts38
1 files changed, 37 insertions, 1 deletions
diff --git a/data/recipes/default.ts b/data/recipes/default.ts
index 24122b5d..33b433a6 100644
--- a/data/recipes/default.ts
+++ b/data/recipes/default.ts
@@ -22,13 +22,25 @@ export interface Recipe {
tile?: string,
inputs: (string | null)[],
outputs: (string | null)[],
- action: "instant" | "passive" | "active" | "demand"
+ action: "instant" | "passive" | "active" | "demand" | "demand"
duration?: number
revert_duration?: number,
warn?: boolean,
points?: number,
}
+function trash_output(ifull: string) {
+ const [i, ic] = get_container(ifull)
+ if (i == "plate") return ifull
+ if (i == "glass") return ifull
+ if (i == "pot") return ifull
+ if (i == "foodprocessor") return ifull
+ if (i == "dirty") return ifull
+ if (ic == "glass") return "glass"
+ if (ic == "plate") return "dirty-plate"
+ return null
+}
+
export const all_items = new Set<string>()
export function auto_trash() {
for (const ifull of all_items) {
@@ -57,6 +69,15 @@ export function out(r: Recipe) {
console.log(`- ${JSON.stringify(r).replaceAll("\"active\"", "!active").replaceAll("\"passive\"", "!passive").replaceAll("\"instant\"", "!instant")}`);
}
+export function edible(item: string) {
+ let i = item
+ if (!item.endsWith("-plate") && !item.endsWith("-glass")) {
+ i += "-plate"
+ out({ action: "instant", inputs: [item], outputs: [i] })
+ }
+ out({ action: "demand", inputs: [i], outputs: [trash_output(i)], duration: 10 })
+}
+
export function cut(from: string, to?: string, to2?: string) {
out({ action: "active", duration: 2, tile: "cuttingboard", inputs: [from], outputs: [to ?? ("sliced-" + from), to2 ?? null] })
}
@@ -120,6 +141,7 @@ export function combine(container: string, ...inputs: string[]) {
}
}
+
if (import.meta.main) {
out({ action: "active", duration: 2, tile: "sink", inputs: ["dirty-plate"], outputs: ["plate"] })
@@ -145,6 +167,12 @@ if (import.meta.main) {
combine("plate", "steak-pot", "sliced-tomato", "bread-slice")
+ edible("steak-plate")
+ edible("bread-slice-steak-plate")
+ edible("bread-slice-sliced-tomato-plate")
+ edible("bread-slice-sliced-tomato-steak-plate")
+ out({ action: "demand", inputs: ["bread"], outputs: [], duration: 0 })
+
crate("rice")
crate("fish")
crate("coconut")
@@ -155,6 +183,10 @@ if (import.meta.main) {
cook("rice")
out({ action: "instant", inputs: ["sliced-fish", "cooked-rice-pot"], outputs: ["nigiri", "pot"] })
+ out({ action: "instant", inputs: ["plate", "cooked-rice-pot"], outputs: ["cooked-rice-plate", "pot"] })
+ edible("cooked-rice-plate")
+ edible("nigiri")
+
// coconut milk and strawberry puree
process("strawberry", "strawberry-puree")
process("coconut", "milk")
@@ -166,11 +198,15 @@ if (import.meta.main) {
// icecream
out({ action: "passive", inputs: ["strawberrymilk-foodprocessor"], outputs: ["strawberry-icecream-foodprocessor"], tile: "freezer", duration: 20 })
out({ action: "instant", inputs: ["strawberry-icecream-foodprocessor", "plate"], outputs: ["foodprocessor", "strawberry-icecream-plate"] })
+ edible("strawberry-icecream-plate")
// drinks
out({ action: "instant", inputs: ["glass"], outputs: ["water-glass"], tile: "sink" })
out({ action: "instant", inputs: ["glass", "milk-foodprocessor"], outputs: ["milk-glass", "foodprocessor"] })
out({ action: "instant", inputs: ["glass", "strawberrymilk-foodprocessor"], outputs: ["strawberrymilk-glass", "foodprocessor"] })
+ edible("water-glass")
+ edible("strawberrymilk-glass")
+
auto_trash()
}