The pack
cookingCounter
function cookingCounter(): Pack<{ cookingCounter: CookingCounterApi }>
The cooking-counter pack: game.cookingCounter, Cooking Fever's rules. No options.
Helpers
burgerKitchen
const burgerKitchen: KitchenSet
The burger joint: a grill that burns, a fryer and a soda machine; burgers with cheese and salad.
cafeKitchen
const cafeKitchen: KitchenSet
The café: espresso and steamed milk built into cups, cakes from the oven.
createKitchen
function createKitchen(options: KitchenOptions = {}): Kitchen
Open a kitchen. Throws, with every fault, on options validateKitchen refuses.
createKitchenAutopilot
function createKitchenAutopilot(kitchen: Kitchen, options: { pace?: number } = {}): KitchenAutopilot
A cook for kitchen, acting every pace seconds (default 0.45).
validateKitchen
function validateKitchen(options: KitchenOptions = {}): string[]
Check a kitchen's options. Empty when it can be played.
Types
CookingCounterApi
interface CookingCounterApi
What the cooking-counter pack adds to a game: game.cookingCounter.
create: typeof createKitchen— Open a kitchen.validate: typeof validateKitchen— Check a kitchen's options.burger: typeof burgerKitchen— The built-in burger joint.cafe: typeof cafeKitchen— The built-in café.autopilot: typeof createKitchenAutopilot— A cook for an attract mode or a test.
DishDef
interface DishDef
A dish: one thing as it is (serve), or a stack built on a plate from base up through layers, in order.
id: string— Unique dish name: the id customers order andservematches.name?: string— Display name for the menu; optional.price: number— What a customer pays for the dish, in the shift's money.weight?: number— How often it is ordered. Default 1.serve?: string— A single thing served as it is (a station'smakesor a bin item); set this orbase, not both.base?: string— The bin item or station product put on the plate first; set this orserve, not both.layers?: string[]— Things stacked onbasein this order to finish the dish; default none.
Kitchen
interface Kitchen
A kitchen.
readonly state: KitchenState— The live stations, plates and waste; read it freely, but change it only through the methods.readonly service: Service— The customers' shift (thecustomerspack): parties, orders, patience and money.readonly set: KitchenSet— The kitchen definition in use: stations, bins and dishes.cook(station: string): Refusal— Start cooking at a station, in a free slot.toPlate(plate: number, from: Source): Refusal— Put something on a plate: it must make the plate's stack the start of some dish.serve(party: string, from: Source): Refusal— Serve a waiting customer a dish: a finished plate, or something served as it is.trash(from: Source): Refusal— Throw away a plate's stack or a station's cooked or burnt slot.dishOf(stack: readonly string[]): DishDef | null— The dish a stack makes, or null.starts(stack: readonly string[]): boolean— Whether a stack is the start of some dish.step(dt: number): void— Advances the kitchen and the shift bydtseconds in fixed 1/60 s ticks, counting at most 0.25 s per call; does nothing once the shift is over. Throws ifdtis negative or not a number.view(): KitchenView— A deep copy of the current state, with the dish each plate makes.drain(): KitchenEvent[]— Returns and clears the events since the last drain; only the latest 512 are kept.snapshot(): KitchenSave— Saves the whole kitchen and its shift as plain JSON (a deep copy).restore(save: KitchenSave): void— Loads a save made bysnapshot, replacing the kitchen and shift and discarding undrained events.
KitchenAutopilot
interface KitchenAutopilot
A cook that acts on a kitchen.
act(dt: number): string | null— Advance its clock; when it is ready, do the most urgent thing and say what.
KitchenEvent
type KitchenEvent = | { kind: 'cook'; station: string } | { kind: 'cooked'; station: string } | { kind: 'burnt'; station: string } | { kind: 'plate'; plate: number; item: string; dish: string | null } | { kind: 'trash'; item: string } | ServiceEvent
Something that happened in the kitchen, or with the customers.
KitchenOptions
interface KitchenOptions
A kitchen's options.
seed?: number— Default 1.kitchen?: KitchenSet— Stations, bins and dishes. DefaultburgerKitchen.plates?: number— Plates to build dishes on. Default 3.spots?: number— Places at the counter. Default 4.service?: Omit<ServiceOptions, 'menu' | 'flow' | 'places' | 'seed'>— The customers' shift (kinds, arrivals, duration, goal...): the counter's flow and menu are set by the kitchen.
KitchenSave
interface KitchenSave
A kitchen saved as plain JSON.
kitchen: KitchenState— The stations, plates and waste.service: ServiceSave— The customers' shift, as saved by thecustomerspack.carry: number— Seconds ofsteptime not yet spent, under one 1/60 s tick.
KitchenSet
interface KitchenSet
A whole kitchen.
stations: StationDef[]— The cooking stations.bins: string[]— Things ready at once, without cooking.dishes: DishDef[]— What customers can order; at least one.
KitchenState
interface KitchenState
Where the kitchen stands.
stations: { id: string; slots: Slot[]; held: number }[]— Each station's live state, in the kitchen's station order: itsslots(null when empty) andheld, the finished things waiting in its holder.plates: string[][]— Each plate's stack, bottom first.waste: number— Things thrown away.
KitchenView
interface KitchenView
What is where.
kitchen: KitchenState— A copy of the kitchen's stations, plates and waste.service: ServiceState— A copy of the customers' shift state: clock, phase, money and parties.dishes: (string | null)[]— The dish each plate makes as it stands, or null while unfinished.
Slot
type Slot = null | { state: 'cooking' | 'done' | 'burnt'; t: number }
A station's slot: empty, or cooking (t seconds in), cooked (t seconds waiting), or burnt.
Source
type Source = { bin: string } | { station: string; slot?: number } | { plate: number }
Where to take something from: a bin, a station (its holder, or a cooked slot), or a plate.
StationDef
interface StationDef
A station: it cooks one thing in each of its slots.
id: string— Unique station name, used bycook, bySourceand in events.makes: string— What it makes.slots: number— How many things it can cook at once; a whole number, 1 or more.time: number— Seconds to cook.burn?: number— Seconds a cooked thing can wait in its slot before it burns. Default it never does.hold?: number— Cooked things go on to a holder of this many, freeing the slot (fries to the tray, drinks to the rack).auto?: boolean— It starts again by itself while there is room.


