// Undercooked — the wire enums (phase 07 task 03). // // The client's vocabulary for the sim's StrEnums (src/undercooked/sim/model.py) // and the protocol's `ErrorCode` (src/undercooked/server/protocol.py). The // wire carries the *string values* (a StrEnum's `.value`); these frozen sets // are what `net/decode.js` maps against and what a frame's values are // checked against. // // Drift is a build failure, not a surprise: `tests/unit/test_client_enum_parity.py` // reads this file and asserts each set is set-equal to the Python enum, in // both directions (the same guard pattern as `test_protocol_doc_sync.py`). // Add a value to the sim and forget it here (or vice versa) and the gate // fails, naming the missing value. /** The terrain under a grid cell (`TileKind`). */ export const TILE_KIND = Object.freeze([ "floor", "counter", "wall", "void", ]); /** The kitchen fixture types (`StationKind`). */ export const STATION_KIND = Object.freeze([ "spawn_shelf", "chop_board", "stove", "prep", "serve", "sink", "trash", ]); /** Ingredient / dish types (`ItemKind`). */ export const ITEM_KIND = Object.freeze([ "tomato", "onion", "lettuce", "dough", "patty", "rice", "fish", "plate", ]); /** The preparation stage of an item (`ItemForm`). */ export const ITEM_FORM = Object.freeze([ "raw", "chopped", "cooking", "cooked", "burnt", "plated", "dirty", ]); /** The four directions; the wire's `f` is an index into this list (PLAN §4: 0-3). */ export const FACING = Object.freeze(["up", "right", "down", "left"]); /** The transient FX/log event kinds (`EventKind`; `encode_events`' `k`). */ export const EVENT_KIND = Object.freeze([ "chopped", "cooked", "ready", "served", "burnt", "order_missed", "fire_started", "denied", "score", "stunned", "washed", "trashed", "round_end", "wasted", "picked", "dropped", "handed_off", "trashed_already_empty", "tick_slow", "err", "resync", "ghost_on", "ghost_off", "ghost_park", ]); /** The stable rejection codes (`ErrorCode`, docs/PROTOCOL.md "Error codes"). */ export const ERROR_CODE = Object.freeze([ "unknown_type", "bad_json", "bad_field", "too_big", "rate_limited", "not_seated", "not_host", "level_locked", "wrong_state", "room_full", "room_gone", "protocol_mismatch", "evicted", "internal", ]); // The extras the renderer (task 04) needs. Not in the parity gate's // seven, but the same discipline applies: the wire's short strings. /** What a cook is doing this tick (`PlayerState`; the wire's `s`). */ export const PLAYER_STATE = Object.freeze([ "idle", "moving", "using", "stunned", "disconnected", ]); /** A station's lifecycle (`StationState`; the wire's `s`). */ export const STATION_STATE = Object.freeze([ "idle", "working", "ready", "busy", "dirty", "blocked", ]); /** The hazard families (`HazardKind`; the wire's `t`). */ export const HAZARD_KIND = Object.freeze([ "fire", "spill", "moving_obstacle", "rush", ]); /** The terminal outcome of a round (`RoundResult`). */ export const ROUND_RESULT = Object.freeze(["won", "lost", "aborted"]);