aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-20 14:00:38 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-23 19:21:49 +0200
commit5bf50cd276a568f55fb1d5aedef96e614bed015b (patch)
tree94adf4dbed06a407e3b3223175d4e5a4e0a21e22 /data
parent7d721cae4241e01dd3f88b38a7d005d18d647454 (diff)
downloadhurrycurry-5bf50cd276a568f55fb1d5aedef96e614bed015b.tar
hurrycurry-5bf50cd276a568f55fb1d5aedef96e614bed015b.tar.bz2
hurrycurry-5bf50cd276a568f55fb1d5aedef96e614bed015b.tar.zst
generated recipes, adjust duration, rename items, other stuff
Diffstat (limited to 'data')
-rw-r--r--data/demands.yaml15
-rw-r--r--data/items.yaml78
-rw-r--r--data/map.yaml21
-rw-r--r--data/recipes.ts118
-rw-r--r--data/tiles.yaml30
5 files changed, 96 insertions, 166 deletions
diff --git a/data/demands.yaml b/data/demands.yaml
index 375eeb8b..08331587 100644
--- a/data/demands.yaml
+++ b/data/demands.yaml
@@ -1,6 +1,9 @@
-- { from: burger-meal, to: dirty-plate, duration: 15 }
-- { from: tomatoburger-meal, to: dirty-plate, duration: 20 }
-- { from: tomatosteak-meal, to: dirty-plate, duration: 20 }
-- { from: steak-meal, to: dirty-plate, duration: 15 }
-- { from: bread-meal, to: dirty-plate, duration: 15 }
-- { from: sliced-tomato-meal, to: dirty-plate, duration: 10 }
+- { from: bread-plate, to: dirty-plate, duration: 10 }
+- { from: steak-plate, to: dirty-plate, duration: 10 }
+- { from: sliced-tomato-plate, to: dirty-plate, duration: 10 }
+
+- { from: bread-steak-plate, to: dirty-plate, duration: 15 }
+- { from: bread-sliced-tomato-plate, to: dirty-plate, duration: 15 }
+- { from: sliced-tomato-steak-plate, to: dirty-plate, duration: 15 }
+
+- { from: bread-sliced-tomato-steak-plate, to: dirty-plate, duration: 20 }
diff --git a/data/items.yaml b/data/items.yaml
deleted file mode 100644
index ddca5e11..00000000
--- a/data/items.yaml
+++ /dev/null
@@ -1,78 +0,0 @@
-# tomato pipeline
-tomato:
- traits:
- - raw
- expires: 5
-sliced-tomato:
- traits:
- - food
-sliced-tomato-meal:
- traits:
- - meal
-# bread pipeline
-flour:
- traits:
- - raw
- expires: 180
-dough:
- traits:
- - bakeable
-bread:
- traits:
- - food
-bread-meal:
- traits:
- - meal
-# steak pipeline
-raw-steak:
- traits:
- - raw
- expires: 2
-steak:
- traits:
- - food
-steak-meal:
- traits:
- - meal
-
-# combination meals
-tomatosteak-meal:
- traits:
- - meal
-burger-meal:
- traits:
- - meal
-tomatoburger-meal:
- traits:
- - meal
-
-# containers
-glass:
- traits:
- - container
- - cup
- - empty-cup
-water:
- traits:
- - container
- - cup
-plate:
- traits:
- - container
- contains:
- - food
- - glass
-dirty-glass:
- traits:
- - dirty
- - glass
-dirty-plate:
- traits:
- - dirty
-
-# liquid
-liquid-water:
- traits:
- - raw
- - liquid
- expires: 1000
diff --git a/data/map.yaml b/data/map.yaml
index aa065a47..de121cc4 100644
--- a/data/map.yaml
+++ b/data/map.yaml
@@ -3,19 +3,19 @@ map:
- "|ctc.ctc.ctc.ctc.ctc.|"
- "|.....c..............|"
- "|c...c...+--www---dd-+"
- - "|tc.ctc..|##...CC#..D|"
- - "|c...c...w........~.S|"
+ - "|tc.ctc..|SS...CC#..X|"
+ - "|c...c...w........~.R|"
- "|c.......w..######..T|"
- "|tc......w..........F|"
- - "|c.....ct|##ss#oopp#X|"
+ - "|c.....ct|##ss#oo####|"
- "+---dd---+-----------+"
- "......................"
- ".........!............"
- "......................"
tiles:
- "~": chef-spawn
- "!": customer-spawn
+ "~": floor
+ "!": floor
".": floor
"+": wall
"-": wall
@@ -27,10 +27,17 @@ tiles:
"w": window
"s": sink
"o": oven
- "p": pan
+ "S": stove
"C": cuttingboard
- "S": raw-steak-crate
+ "R": raw-steak-crate
"T": tomato-crate
"F": flour-crate
"D": dirty-plate-crate
"X": trash
+
+chef_spawn: "~"
+customer_spawn: "!"
+
+items:
+ "S": pot
+ "w": plate
diff --git a/data/recipes.ts b/data/recipes.ts
index dcd73d8e..534f1e6d 100644
--- a/data/recipes.ts
+++ b/data/recipes.ts
@@ -3,74 +3,102 @@
interface Recipe {
tile?: string,
- inputs: string[],
- outputs: string[],
+ inputs: (string | null)[],
+ outputs: (string | null)[],
action: "instant" | "passive" | "active"
duration?: number
+ warn?: boolean
}
const all_items = new Set<string>()
+function auto_trash() {
+ for (const ifull of all_items) {
+ let [i, ic] = get_container(ifull)
+ if (i == "plate") continue
+ if (i == "pot") continue
+ if (i == "dirty") continue
+ if (ic == "plate") ic = "dirty-plate"
+ out({
+ action: "instant",
+ tile: "trash",
+ inputs: [ifull],
+ outputs: [ic]
+ })
+ }
+}
+
function out(r: Recipe) {
- r.inputs.forEach(i => all_items.add(i))
- r.outputs.forEach(i => all_items.add(i))
- console.log(`- { tile: ${r.tile ?? null}, inputs: ${JSON.stringify(r.inputs)}, outputs: ${JSON.stringify(r.outputs)}, action: !${r.action + " " + (r.duration ?? "")} }`);
+ r.inputs.forEach(i => i ? all_items.add(i) : void 0)
+ r.outputs.forEach(i => i ? all_items.add(i) : void 0)
+ console.log(`- { tile: ${r.tile ?? null}, inputs: ${JSON.stringify(r.inputs.filter(e => e))}, outputs: ${JSON.stringify(r.outputs.filter(e => e))}, action: !${r.action + " " + (r.duration ?? "")}, warn: ${r.warn ?? false} }`);
}
-type Component = (e: string) => void
-const cut = (new_name?: string): Component => e => {
- out({ action: "active", duration: 2, tile: "cuttingboard", inputs: [e], outputs: [new_name ?? ("sliced-" + e)] })
+function cut(from: string, to?: string) {
+ out({ action: "active", duration: 2, tile: "cuttingboard", inputs: [from], outputs: [to ?? ("sliced-" + from)] })
}
-const cook = (new_name?: string): Component => e => {
- const i = e + "-pot"
- const o = (new_name ?? ("cooked-" + e)) + "-pot"
- out({ action: "instant", inputs: ["pot", e], outputs: [i] })
- out({ action: "passive", duration: 2, tile: "stove", inputs: [i], outputs: [o] })
+function cook(from: string, to?: string) {
+ const i = from + "-pot"
+ const o = (to ?? ("cooked-" + from)) + "-pot"
+ out({ action: "instant", inputs: ["pot", from], outputs: [i] })
+ out({ action: "passive", duration: 10, tile: "stove", inputs: [i], outputs: [o] })
+ out({ action: "passive", duration: 10, tile: "stove", inputs: [o], outputs: ["burned-pot"], warn: true })
}
-const crate: Component = e => out({ action: "instant", tile: e + "-crate", inputs: [], outputs: [e], })
-
-function item(name: string, ...components: Component[]) {
- for (const f of components) {
- f(name)
- }
+function bake(from: string, to?: string) {
+ const o = (to ?? ("cooked-" + from))
+ out({ action: "passive", duration: 20, tile: "oven", inputs: [from], outputs: [o] })
+ out({ action: "passive", duration: 20, tile: "oven", inputs: [o], outputs: ["burned"], warn: true })
+}
+function crate(item: string) {
+ out({ action: "instant", tile: item + "-crate", inputs: [], outputs: [item], })
}
+function get_container(ifull: string): [string, string | null] {
+ const iparts = ifull.split("-")
+ const ic = iparts.pop()
+ if (ic && iparts.length && ["pot", "plate"].includes(ic)) return [iparts.join("-"), ic]
+ return [ifull, null]
+}
function combine(container: string, ...inputs: string[]) {
- const open = inputs.map(i => [i])
+ const open = inputs.map(ifull => {
+ const [i, ic] = get_container(ifull)
+ out({ action: "instant", inputs: [container, ifull], outputs: [i + "-" + container, ic] })
+ return [i]
+ })
+ const seen = new Set<string>()
while (1) {
- const e = open.pop()
- if (!e) break;
- const cur = e.join("-") + "-" + container
- for (const i of inputs) {
- if (e.includes(i)) continue
- const parts = [...e, i]
+ const cur = open.pop()
+ if (!cur) break;
+ const c = cur.join("-") + "-" + container
+ for (const ifull of inputs) {
+ const [i, ic] = get_container(ifull)
+ if (cur.includes(i)) continue
+ const rkey = cur.join("-") + "#" + i
+ if (seen.has(rkey)) continue
+ seen.add(rkey)
+
+ const parts = [...cur, i]
parts.sort()
const o = parts.join("-") + "-" + container
- if (all_items.has(o)) continue
open.push(parts)
out({
action: "instant",
- inputs: [cur, i],
- outputs: [o]
+ inputs: [c, ifull],
+ outputs: [o, ic]
})
}
}
}
-item("tomato", cut(), crate, cook("tomato-soop"))
-combine("plate", "steak", "sliced-tomato", "bread")
+out({ action: "active", duration: 3, inputs: ["flour"], outputs: ["dough"] })
+out({ action: "active", duration: 2, tile: "sink", inputs: ["dirty-plate"], outputs: ["plate"] })
-for (const i of all_items) {
- const parts = i.split("-");
- const container = parts.pop()!;
- if (parts.length >= 1 && ["pot", "plate"].includes(container)) {
- out({
- action: "instant",
- tile: "trash",
- inputs: [i],
- outputs: [container]
- })
- } else {
- out({ action: "instant", tile: "trash", inputs: [i], outputs: [] })
- }
-}
+crate("tomato")
+crate("raw-steak")
+crate("flour")
+crate("dirty-plate")
+cut("tomato")
+bake("dough", "bread")
+cook("raw-steak", "steak")
+combine("plate", "steak-pot", "sliced-tomato", "bread")
+auto_trash()
diff --git a/data/tiles.yaml b/data/tiles.yaml
deleted file mode 100644
index 078a6f29..00000000
--- a/data/tiles.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-# kitchen
-- counter
-- watercooler:
- - accepts:
- - empty-cup
-- oven:
- - accepts:
- - bakeable
-- service:
- - accepts:
- - container
-
-# supply
-- tomato-bag:
- - generates:
- - tomato
-- flour-bag:
- - generates:
- - flour
-- freezer:
- - generates:
- - steak
-- sink:
- - accepts:
- - dirty
- - cup
-
-# customers
-- table
-- chair