assassinationKit.Agent: one per player, on a synced entity that player's own engine spawns and owns (the client does this; never place it by hand). Holds that player's run: chosen start, outfit and gear, the run record (seen, alarms, bodies found, innocents killed, guards and civilians knocked out or killed, accidents, disguises worn, time, exit), whether they have left, and their rating result. Every peer reads it, which is what the team grade and the co-op debrief use.
assassinationKit.Civilian: a tag component for Sealed Orders missions. Put it on any character who is neither a target nor a guard (a shopkeeper, a passer-by not made with townsfolkKit) so that knocking them out or killing them is recorded as harming an innocent and rated accordingly. townsfolkKit people already count as civilians without it.
assassinationKit.Gallery: put it on any plain entity in a scene that has a floor and a player. When play starts it builds the Sealed Orders gallery around the entity: one station per opportunity kind (with a "Run it" prompt that plays the staged accident or opening on a stand-in), one per exit kind (with a "Try it" prompt for the leaving moment), and a style wall terminal that shows every rating table and every select, briefing and debrief style side by side. Fields: `page` (ratings or screens), `openWall`.
assassinationKit.Mission: the one switch that makes a scene a Sealed Orders mission. Put it on one synced entity (entity.spawnSynced) in the mission scene. Its authored fields pick the contract to offer (empty = show the contract select), the rating table, the briefing/debrief style and the select style; its synced state fields (phase, targets, opps, exits, intel, ready) are written only by the peer that owns the entity (the room host) and read by everyone, late joiners included. Starts the player-side runtime (client) on every peer.
assassinationKit.api: the one interface a world uses for Sealed Orders. `local SO = require("assassinationKit.api")` (inside another package `require("~assassinationKit.api")`). Every swappable part is used the same way: `SO.define(family, id, def)`, `SO.use(family, id)`, `SO.list(family)`, `SO.configure({ rating, screens, select })`. Also contracts (`SO.contract`, `SO.contracts`, `SO.defineContract`, `SO.problems`), words (`SO.words`), rating (`SO.rate`, `SO.teamRate`), mastery (`SO.mastery`, `SO.resetMastery`), events (`SO.on`), commands to the host (`SO.command`, `SO.learn`), the shared state (`SO.state`) and `SO.place` to put a Mission in a scene build.
assassinationKit.builtins: loads every built-in registry entry once (the rating tables, the opportunity and exit kinds, and the screen styles) so requiring it makes the whole kit ready. Required by the api and the Mission component.
assassinationKit.bus: Sealed Orders' event bus and command channel. on(name, fn) and emit(name, ev) are local; broadcast(name, ev) reaches every peer (channel sealedOrders:evt). cmd(op, a, b) sends a request to the peer that owns the Mission (sealedOrders:cmd), or applies it at once on that peer. Events a game can listen to: phase, intel, oppStep, oppDone, targetDown, record, toast, routine, exited, debrief.
assassinationKit.client: each player's side of a running mission, on every peer. Spawns and writes this player's Agent record; listens to the other kits (concealKit kills, knock-outs, bodies found and alarms; guards spotting the player, relayed by the host; disguiseKit outfits and blown covers; loreKit notes, earshotKit overheard talk and dialogueKit conversations as intel); offers the prompt for the current step of each opportunity, each search and each open exit at its place; puts the player at their chosen start in their chosen outfit with their gear; shows the select, briefing and debrief screens for the phase; and keeps the tracker, markers and toasts up to date. Started by the Mission component.
# contract (assassinationKit data contract, Sealed Orders)
One assassination contract, written as data: one `<id>.data/values.yaml` per contract with `contract: assassinationKit.contract`. Sealed Orders reads every contract file in the world, checks it, and shows it on the contract select screen.
Places (`at`) are the **names of entities in the mission scene**: a target's routine stops, opportunity props, exits and start points. Move the entity and the contract follows.
| field | meaning |
|---|---|
| `id`, `title` | the contract's id and its name on the board |
| `client`, `location`, `brief` | who ordered it, where, and the briefing text |
| `scene` | the scene to load for it (empty = the current scene) |
| `rating` | the rating table to grade it with (empty = the world's choice) |
| `hidden` | true = offered only by a Mission whose `offer` names it (examples, test contracts) |
| `par` | seconds; finishing faster earns the time bonus |
| `lexicon[] {key, word}` | rename words for this contract (`target`, `opportunity`, `exit`, `intel`, tier names...) |
| `targets[]` | `{id, name, entity, title, portrait, description, traits[], guards[], routine[{at, stay, doing}]}` |
| `intel[]` | `{id, title, text, source (overhear, note, talk, search, briefing), ref, reveals[{opportunity, target, exit}]}` |
| `opportunities[]` | `{id, kind, title, hint, target, hidden, at, steps[{id, kind, text, at, item, role, ref, hold}], outcome{type kill or opening, effect, text, opens[]}}` |
| `exits[]` | `{id, kind (boat, cart, gate, rope, hatch), title, at, text, lockedBy}` |
| `starts[]` | `{id, title, at, text, unlock (mastery level), outfit}` |
| `outfits[]` | `{id, title, role (a disguiseKit role), variant, text, unlock (-1 = found in the level only)}` |
| `gear[]` | `{id, title, item (inventoryKit item) or lure (stealthKit lure), count, text, unlock}` |
| `mastery[]` | experience needed for mastery levels 1, 2, 3... |
Step kinds: `find` (pick up `item` or search the entity `at`), `prepare` (use `item` at the prop `at`), `wear` (be dressed as `role`), `talk` (finish a dialogueKit conversation `ref`), `reach` (stand at `at`), `wait` (until the target reaches `at` on his round), `trigger` (set it off at `at`).
`lockedBy` on an exit names an opportunity id or an intel id; the exit stays shut until that opportunity ends or that intel is learned.
## Translating a contract
Any text field (titles, `brief`, `name`, `description`, `traits`, `doing`, intel and step `text`, `hint`, `outcome.text`, lexicon `word`...) may hold a **catalog key** instead of the words: `"@<namespace>.<key>"`. It reads as `i18n.t("<namespace>.<key>")` in each player's language, and every key in the contract is read again when the language changes, so no code is needed:
```yaml
values:
id: one_bad_captain
title: "i18n:one_bad_captain.title"
intel:
- { id: the_round, title: "i18n:one_bad_captain.intel_round_title", text: "i18n:one_bad_captain.intel_round_text", source: briefing }
```
```json
// /locales/en/one_bad_captain.json // /locales/pt-BR/one_bad_captain.json
{ "title": "One Bad Captain", ... } { "title": "Um Capitão Ruim", ... }
```
A world's catalogs go in `/locales/<lang>/<namespace>.json` (one namespace per contract is tidy); a package's in its own `locales/`. Places (`at`, `entity`, `guards`) are entity names, not text, and stay as written. Code that needs the key itself (to send it to other players, each of whom reads it in their own language) asks `require("assassinationKit.lexicon").raw(row, "text")`; `Lexicon.text(s)` reads a key or plain text.
Sealed Orders checks each file beyond this schema (unknown opportunity or exit kinds, places that are not in the scene, a reveal naming an id that does not exist) and names the field at fault, e.g. `opportunities[2].kind: "posion" is not an opportunity kind (poison, heavyDrop, ...)`.
assassinationKit.contracts: reads every contract .data file in the world (contract: assassinationKit.contract), checks each one beyond its schema (opportunity and exit kinds that exist, ids that reveals and locks name, places that are entities in the scene) and keeps them by id. define(table) adds a contract from code. Problems name the exact field at fault.
# exampleMission
Sealed Orders' teaching mission, "The Mayor's Last Errand": a blockout market square in Hollowmere (shapes on purpose, so the wiring is easy to read) with one target (Mayor Quill) walking between the town well and the bakery, his guard, two neighbours whose gossip reveals the loose flower box over the bakery door (a heavyDrop opportunity), two hiding spots, and the South Gate exit. It is the finished result of the example guide; open it, press Play, and the contract list, briefing, mission and debrief all run. Its contract is `examples/mayor_quill.data` (hidden, so it only shows here).
assassinationKit.gallery: a walk-through gallery of every part registered in Sealed Orders, built at runtime from the registry so a world's own parts appear too. A row of stations, one per opportunity kind (prop, stand-in, and a "Run it" prompt that plays the kind's staged accident with the ink splash or its opening), a row of the exit kinds (each with its prop and a "Try it" prompt that plays the leaving moment), and a style wall terminal that opens every rating table on a quiet and a loud sample run, and every select, briefing and debrief style side by side. Used by the Gallery component.
assassinationKit.hud: the in-run heads-up layer, drawn through navUiKit: a tracker line per target, per revealed opportunity (its current step) and per open exit; markers over targets that intel has pointed out and over open exits; toasts for intel learned, steps done, openings, refusals and eliminations; and the local effect of each staged accident (a load falling, a railing giving way). Each player's own; called by the client.
assassinationKit.kinds: the built-in opportunity kinds and exit kinds, each one registry entry. Opportunity kinds (poison, heavyDrop, riggedSwap, impersonate, lure, sabotage, guardAway, doorOpen) give a default chain of steps, the words of each prompt and the outcome the host runs when the chain completes: a staged kill shown as an ink splash, or an opening (the target alone, a guard sent off, a door left open, an exit opened). Exit kinds (boat, cart, gate, rope, hatch) give the prompt, the leaving line and the look of the way out. A game adds its own with Registry.define('opportunity' or 'exit', id, def).
assassinationKit.lexicon: every word a player reads in Sealed Orders (contract, target, opportunity, intel, exit, start, outfit, gear, screen labels), read from the kit's catalogs (locales/en and locales/pt-BR, namespace `sealedorders`, keys `word_<key>`). A game renames any of them with set({ opportunity = 'Angle' }) and a contract can rename words for itself; both win over the catalogs, and a renamed word may itself be a catalog key ('@my_ns.angle'). word(key, contract?) answers the word to show. It is also the one way data text is translated: text(s) reads a '@namespace.key' reference with i18n.t (anything else as written), localize(tbl) resolves every reference inside a table in place and again when the language changes, raw(tbl, field) gives back the reference (send references, not words, to other players), t(key, values) reads a line of the kit's own catalog.
assassinationKit.links: lazy, optional access to the kits Sealed Orders glues together (stealthKit, concealKit, takedownKit, disguiseKit, aiKit, townsfolkKit, earshotKit, loreKit, dialogueKit, interactKit, inventoryKit, navUiKit, saveKit, impactFrames). get(name) answers the kit's api table or nil, so a world missing one kit still runs the rest. Also small helpers every part uses: positions, the local player, distances.
# make-an-assassination-contract
Makes a new Sealed Orders (assassinationKit) assassination contract (a new stealth mission) for a target the creator invents, from the idea to a mission played through twice: it designs the target and everything around him, writes the contract and its intel files, wires the scene, checks it, then plays it quiet and loud to prove the staged kill, the debrief and the grade all work.
## What it does
1. **Survey.** Reads the kit's guides, the contracts, exchanges, notes and conversations already in the world (so new ids do not clash), and the scene: its build file, where its cast lives, whether it already places a Mission, the named places and people in it, and the ground the NavMap covers. Changes nothing.
2. **Design.** One plan every later job builds from: contract id, title, client, location, brief, par; the target with his look, 1-3 guards and a 2-4 stop routine; every named place with a position; the intel (a briefing row, an overheard earshotKit exchange, a loreKit note, a dialogueKit conversation) and what each reveals; 1-3 opportunities of different kinds (poison, heavyDrop, riggedSwap, impersonate, lure, sabotage, guardAway, doorOpen) with their find / prepare / wear / talk / reach / wait / trigger steps and a kill or opening outcome; exits (boat, cart, gate, rope, hatch), one open and one `lockedBy` an opportunity or intel; starts, outfits and gear with mastery unlocks; the mastery scale, rating table and screen style.
3. **Build**, two jobs at once from the same names:
- **Data files**: `contracts/<id>.data/values.yaml` (`contract: assassinationKit.contract`), each exchange at `<id>/exchanges/<exchange>.data/values.yaml` (`contract: earshotKit.exchange`, with `key` and `grants`), each conversation at `conversations/<conv>.json` with its strings in `locales/en/` (and `locales/pt-BR/`), every `.metadata` described.
- **Scene wiring**: a cast module with `build()` called (with `pcall`) from the scene's build: every new place a named marker entity, the target and guards as `TD.guard(..., { preset = "hideGuard" })`, speakers as townsfolk people, the informer with a `dialogueKit.Talker`, the note as a `loreKit.Lore`, a wardrobe for any wear step, hiding spots, the NavMap / stealthKit Director / EarshotSettings when missing, and the Mission via `SO.place({ offer = "<id>", ... })` (or the id added to the scene's existing Mission's `offer`).
4. **Check** (up to three rounds, with a fix job between): `SO.reloadContracts()` then `SO.problems()` empty; `SO.checkContract(raw, id, { scene = true })` finds every place in the scene; `require("earshotKit.api").loadAll()` loads each exchange; a second rebuild duplicates nothing; `zero tests run sealedOrdersTests` green.
5. **Play quiet.** In a sub-client: pick the contract, check the briefing, learn intel from its real sources (overhear, read, talk), walk the kill opportunity to the staged accident (`targetDown` with `how = accident`, the ink-splash frame), leave by an open exit, read the debrief lines, grade and mastery.
6. **Play loud.** Again, with a guard knocked out where he is found, an alarm, and a held lethal takedown on the target: the grade must be worse, the alarm and body lines show, the knock-out itself costs nothing.
7. **Finish.** Answers with the contract id, its files, places, opportunities, exits, the check results, both grades, what failed and any kit bugs.
The field-by-field reference every step points at is the guide `how-to-make-an-assassination-contract-with-targets-opportunities-and-exits`; the worked example is `example-build-a-one-target-assassination-mission-from-an-empty-world`, and the shipped contract `contracts/one_bad_captain.data` with its cast `captain/cast.module` is the shape each file copies.
## What it needs
The `assassinationKit` package installed (it brings every kit it stands on) and a scene with ground and a player. Everything goes into authored source, so it survives a reload; nothing in the kit itself is edited.
## Starting it
zero workflow start --name make-an-assassination-contract --args '{"target":"a toll-keeper who drowns debtors","setting":"a river crossing at dusk","opportunities":2}'
All args are optional: `target`, `id`, `scene` (default the startup scene), `setting`, `opportunities` (1-3, default 2), `rating`, `screens`. Then `zero workflow next --runner <you>` and `zero workflow answer --request <id> --value <json>` until it finishes; each request names the shape its answer must have.
assassinationKit.mastery: each player's mastery of each contract, saved in their own saveKit profile under sealedOrders_mastery: experience, level, best tier, runs and the intel they have learned before. level(contractId) and unlocked(contract) answer which start points, outfits and gear this player may pick; award(contract, result) adds a run's experience and answers what it newly unlocked. Works without saveKit too (kept for the session only). Local player only, like saveKit.
assassinationKit.mission: the host side of a running mission. Holds the shared state (phase, each target's fate, each opportunity's revealed flag and current step, open exits, known intel) in the Mission component's synced fields, applies the commands players send (choose a contract, ready up, begin, learn intel, finish a step, open an exit), walks each target round his routine with his guards beside him, checks wait and trigger steps against where the target stands, and runs each opportunity kind's outcome (a staged kill shown as an ink splash, or an opening such as the target alone or a guard sent away). Only the peer that owns the Mission entity runs it; everyone else reads the synced fields.
assassinationKit.moment: the kill moment, the accident visuals and the kit's sound. Called by the HUD (accident `fx` events, mission events), by the client (direct kills), by the screens (button sounds) and by a scene's entrypoint (ambience and music beds). Everything runs on the peer that calls it; the mission's events already reach every peer, so nothing is sent.
## The kill moment
`Moment.kill({ entity = body, text = "The net gives way...", mine = true })`
- **The killer's screen**: a 0.7 s time slow (`engine.holdTimeScale(0.3)`, released on the wall clock), a camera push (field of view in by 7 degrees and back over 1.6 s), a heavy shake at low intensity, impactFrames' `inkSplash` in sepia ink on parchment (`Moment.INK`, `Moment.PAPER`, `Moment.ACCENT`; never red, never black), sepia ink droplets, wash and paper flecks at the body (juiceKit vfx, look `soInk`), the ink sting, and a title card with the accident's text.
- **Players within 40 m**: a lighter stroke, the ink at the body, a light shake, the sting quieter. No time slow, so nobody else's simulation is touched.
- **Everyone else**: the title card only.
A staged kill's moment waits for its accident to land (the load hitting the pier, the glass breaking, the railing going): `mission.stagedKill` broadcasts an `fx` event of kind `kill` with the text, and the HUD hands it here.
## Accident visuals (`Moment.accident(ev)`)
| kind | what is seen and heard |
|---|---|
| heavyDrop | a cargo net of crates (concealKit's crates under a rope net with slings, a hook and the snapped line) falls from crane height, lands in dust with a rumble; cargo crash sound |
| poison | the glass slips, tumbles and breaks with a glint; glass shatter and the body slumping |
| sabotage | a railing section tips over and drops into the water with a splash; wood crack and splash |
| riggedSwap | a snap and a small ink burst; spring snap |
| impersonate, lure, guardAway, doorOpen | a quiet cue: a faint ink puff and the opening motif |
## Sound
- `Moment.sound(name, { volume?, pitch?, at? })`: one of `Moment.SOUNDS` (inkSting, cargoCrash, glassSlump, railSplash, riggedSnap, openingCue, intelChime, stepDone, oppReveal, exitWhoosh, gradeStamp, uiClick, uiHover, paperRustle). `at` makes it spatial. Each sound has a short gap so a burst of events never stacks it.
- `Moment.uiSound(name)`: screen buttons: `click`, `hover`, `open` / `select` (paper rustle), `stamp` (debrief grade), `leave` (exit whoosh).
- `Moment.hudEvent(name, ev, c, pub)`: intel chime, step tick, opportunity reveal, done tick, and a lighter moment for another player's direct kill nearby.
- Phase cues: the contract ambience loops on the select and briefing screens (ducking the harbour beds), a paper rustle as they open, the grade stamp on the debrief.
- `Moment.beds({ ambience = clip, calm = clip, tense = clip, ambienceVolume?, musicVolume? })`: looping beds; the music cross-fades calm to tense while stealthKit's alert is raised and for 14 s after a kill. `Moment.stopBeds()`, `Moment.bedState()`.
Channels: `sfx`, `ui`, `music`, `ambience`, so `audio.setChannelVolume`, `audio.setMasterVolume` and `audio.setMuted` (a settings screen) reach every sound here.
assassinationKit.rating: turns a run's record into rating lines and a grade. facts(record, contract) reads the record once (seen, alarms, bodies found, innocents killed, guards killed, knock-outs, accidents, disguises, time against par, exit); rate(record, contract, tableId) hands those facts to a rating table from the registry and answers { lines, total, tier, tierIndex, tiers, stars?, grade }. team(records, contract, tableId) grades several players' records as one. Pure functions: safe to call anywhere, used by the debrief and the gallery.
assassinationKit.ratingTables: the four built-in rating tables, each defined in the registry's rating family: ranks (named ranks the game can rename, from Phantom down to Butcher), letters (S, A, B, C, D), pointsStars (a score with zero to five stars) and team (one grade for a co-op crew, judged on the whole crew's record). Each table weighs the same facts; a world picks one with configure({ rating = id }) or a contract's rating field. Loaded by the api.
assassinationKit.registry: the one way every swappable part of Sealed Orders is used. Families are opportunity kinds, exit kinds, rating tables, briefing/debrief screen styles and contract select styles; each entry is defined with define(family, id, def), picked with use(family, id) and listed with list(family). The world's current choice for a family lives in settings (configure). Called by the api and by every built-in.
assassinationKit.samples: the sample models of the missionScreens package (Mission Dossier) run through Sealed Orders' contract check, lexicon and rating tables: `contract()`, `selectModel()`, `briefingModel()`, `record("quiet" | "loud")`, `debriefModel(tableId?)`. Built at call time, so they read in the player's language. Used by the gallery's style wall and the tests.
assassinationKit.screens: Sealed Orders' adapter over the missionScreens package (Mission Dossier), which draws the contract select, briefing, debrief and leaving screens. It keeps Sealed Orders' screen id (`sealedOrders_screen`), callback env (`sealedOrders_ui`) and button ids (`so_btn_ready`, `so_btn_back`, `so_btn_replay`, `so_btn_select`, `so_btn_pick_<id>`, `so_btn_<start|outfit|gear>_<id>`); adds each missionScreens style to Sealed Orders' registry (families `screens` and `select`) as an entry that calls the package's style, so `SO.define("screens" | "select", id, def)`, `SO.configure` and the Mission's `screens` / `select` fields choose the style; hands the package only the lexicon words a game or contract renamed, so every other word reads from the package catalogs in the player's language; and plays UI sounds through `moment.uiSound`. API: `select(model, handlers)`, `briefing(model, handlers)`, `debrief(model, handlers)`, `leaving({ exit, kind, lexicon }, seconds, done)`, `hide()`, `build(kind, model, styleId?, size?)`, `adapt(model)`, `ctx()`, `setPhoneCard(on)`, `render()`, `onCallback(id)`, `current()`.
sealedOrdersTests: edit-mode tests for Sealed Orders' pure parts: contract checking and its field-level problems, the registry's built-ins (8 opportunity kinds, 5 exits, 4 rating tables, screen and select styles), every rating table on a quiet and a loud run, free knock-outs, complete debrief lines, abandoned runs, the co-op team grade, the lexicon and mastery gates. Run with `zero tests run sealedOrdersTests`.
assassinationKit.selectBoard: kept so `builtins.module` still loads it; the notice board style itself lives in the missionScreens package (Mission Dossier) and reaches Sealed Orders' registry through `assassinationKit.screens`.
assassinationKit.selectList: kept so `builtins.module` still loads it; the simple list style itself lives in the missionScreens package (Mission Dossier) and reaches Sealed Orders' registry through `assassinationKit.screens`.
# cargoCrash.soundClip
A heavy crash of falling cargo crates and splintering wood with a dusty thud. Played at the spot where a heavy-drop opportunity lands on the target.
# contractAmbience.soundClip
A low, quiet loop of rustling paper and a ticking clock under the contract select and briefing screens; it ducks the level's ambience while a screen is open.
# exitWhoosh.soundClip
A short airy whoosh played the moment a player takes an exit and the leaving screen starts.
# glassSlump.soundClip
A glass tipping over and shattering, followed by a soft body slump. Played where a poisoning opportunity kills the target.
# gradeStamp.soundClip
A firm ink stamp pressed onto paper. Played when the final grade lands on the debrief screen.
# inkSting.soundClip
A short dark musical sting with an ink-splash swell. Played on every kill, staged or direct, together with the bloodless ink-splash frame.
# intelChime.soundClip
A soft two-note chime played when a player learns a piece of intel (overheard, read or told).
# openingCue.soundClip
A quiet low motif played when an opportunity ends in an opening rather than a kill: the target alone, a door left open, a guard sent off.
# oppReveal.soundClip
A light plucked reveal cue played when intel reveals a new opportunity.
# paperRustle.soundClip
A crisp rustle of paper played when the contract select or briefing screen opens.
# railSplash.soundClip
Wood cracking, a railing giving way and a heavy splash into water. Played where a sabotage opportunity kills the target.
# riggedSnap.soundClip
A sharp mechanical snap and click. Played where a rigged-swap opportunity triggers.
# stepDone.soundClip
A short soft tick played when a player completes one step of an opportunity chain.
# uiClick.soundClip
A short dry click for pressing a button on the mission screens.
# uiHover.soundClip
A very soft tick for moving focus or hovering over a button on the mission screens.
assassinationKit.styleCard: kept so `builtins.module` still loads it; the compact card style itself lives in the missionScreens package (Mission Dossier) and reaches Sealed Orders' registry through `assassinationKit.screens`.
assassinationKit.styleCaseBoard: kept so `builtins.module` still loads it; the case board style itself lives in the missionScreens package (Mission Dossier) and reaches Sealed Orders' registry through `assassinationKit.screens`.
assassinationKit.styleScroll: kept so `builtins.module` still loads it; the paper scroll style itself lives in the missionScreens package (Mission Dossier) and reaches Sealed Orders' registry through `assassinationKit.screens`.
# exchange (earshotKit data contract)
An overheard conversation: NPCs talking to each other that a player can eavesdrop on for gossip, intel or clues. One `<id>.data/values.yaml` per exchange, bound with `contract: earshotKit.exchange`, anywhere in the world. earshotKit finds every one (`Earshot.loadAll`, automatic on first use) and checks it, naming the field at fault.
| field | meaning |
|---|---|
| `id` | the exchange's id, used by `Earshot.play`, `Earshot.heard` and events |
| `title` | a short label for logs and the ear meter (default: the id) |
| `speakers` | entity names of who talks, in order; found with `entity.find` |
| `lines[]` | `{ by, text, hold? }`: `by` is the speaker's 1-based index (or `speaker: "Name"` instead; default: alternate), `hold` seconds on screen (default: reading time from the word count, 1.8 to 7.5 s) |
| `radius` | earshot in metres from the speaker of the line (default: the EarshotSettings radius, 7) |
| `trigger` | `meet` (every speaker within `meetRange` of every other, default 3.5 m), `place` (speaker 1 within `placeRadius` of the entity named `at`, optionally between hours `from` and `to` of townsfolkKit/worldClockKit time, e.g. `"21:00"`), `manual` (only `Earshot.play`) |
| `repeat`, `cooldown` | once only (default), or again `cooldown` seconds after it last ended |
| `key` | the line that counts as heard (default: the last) |
| `grants` | strings handed to every listener with the `heard` event (clue ids, quest flags, intel) |
In a data file `by` is a number (`by: 2`); to name the speaker write `speaker: "Guard B"` instead. From code (`Earshot.define`) `by` takes either.
```yaml
contract: earshotKit.exchange
values:
id: docks_gossip
speakers: ["Guard A", "Guard B"]
trigger: meet
lines:
- { by: 1, text: "Captain's ship comes in at midnight." }
- { by: 2, text: "Pier nine again? The usual crates?" }
grants: ["intel_docks_midnight"]
```
# Within Earshot: Overheard Conversations and Eavesdropping Kit (earshotKit)
Let players **overhear NPC conversations** and **eavesdrop** on them for **gossip, intel and clues**. Two guards trade the vault rota at the gate, a merchant mutters about a buried crate at the well after dark, a pair of servants whisper a name: a player who walks close enough reads it, and one who stays in **earshot** for the line that matters gets a `heard` event with the clues the conversation grants. For stealth, detective, mystery, heist and social games, single player or multiplayer.
What a world gets from installing it:
- **Conversations as data.** One `<id>.data/values.yaml` per exchange (`contract: earshotKit.exchange`), or one `Earshot.define{...}` call: speakers (any entities, by name), lines, earshot radius, trigger, repeat, key line, grants.
- **Three triggers.** `meet`: every speaker within `meetRange` (3.5 m) of the others. `place`: speaker 1 within `placeRadius` of a named entity, optionally between hours `from`/`to` of townsfolkKit or worldClockKit time. `manual`: only `Earshot.play(id)`.
- **Multiplayer and late joiners.** A synced `EarshotHost` (spawned on demand by the room host) steps every line on `multiplayer.sessionTime()` and keeps the current exchange, line index and line start in Sync fields, so all players and anyone who joins halfway read the same line.
- **Three looks, one setting.** `bubbles` (speech bubbles over each speaker's head with a tail), `captions` (cinematic caption bar, speaker name in an accent colour), `whisper` (faint italic ticker along the top; words drop to dots near the edge of earshot). Fits phones (390x844) and desktops inside the safe area; reduced-motion aware; takes no input and blocks none.
- **Ear meter.** A small listening meter fills as lines are heard and turns gold on the key line.
- **Speakers face each other** while talking (moved only by the peer allowed to move them; townsfolkKit people are left to their own controller).
- **Events.** `started`, `line`, `ended` on every peer; `heard {id, grants, peer, avatar}` on the hearing peer and on the host for every player.
No dependencies. **townsfolkKit is optional**: its people work as speakers (entities found by name) and its clock gates `place` exchanges; without it `from`/`to` hours are ignored unless worldClockKit answers.
## Start in two steps
1. Put an `EarshotSettings` component on any entity in the scene (it picks the look and spawns the host), or call any `Earshot` function from a scene script.
2. Write an exchange:
```yaml
# exchanges/docks_gossip.data/values.yaml
contract: earshotKit.exchange
values:
id: docks_gossip
speakers: ["Guard A", "Guard B"]
trigger: meet
lines:
- { by: 1, text: "Captain's ship comes in at midnight." }
- { by: 2, text: "Pier nine again? The usual crates?" }
- { by: 1, text: "Same as always. Nobody looks at pier nine." }
grants: ["intel_docks_midnight"]
```
Walk two entities named `Guard A` and `Guard B` together in play and walk close: the lines appear, the meter fills, `heard` fires.
## API
```lua
local Earshot = require("~earshotKit.api") -- from a package; "earshotKit.api" from a world script
Earshot.define(def) -> (ok, problems) -- same shape as the .data values
Earshot.loadAll() -> count -- every exchange .data file in the world (automatic on first use)
Earshot.play(id, { restart? }) -> boolean -- ask the host to start it now (any trigger)
Earshot.stop(id) -> boolean
Earshot.on(name, fn) -> unsubscribe -- "started" {id}, "line" {id, index, text, speaker}, "ended" {id},
-- "heard" {id, grants, peer, avatar}, "*"
Earshot.heard(id, peer?) -> boolean -- this peer by default
Earshot.list() / Earshot.get(id)
Earshot.status() -- host, authority, running exchanges, what is on screen, heard
Earshot.configure({ style = "bubbles"|"captions"|"whisper", radius?, showMeter? })
Earshot.settings() / Earshot.start() / Earshot.problems()
```
`heard` fires once per run on the hearing peer (with `first = true` the first time this peer heard that id) and on the host once per player per exchange id (`host = true`). Hand grants to your own systems there: questKit flags, a clue board, saveKit unlocks.
## Exchange fields
| field | meaning |
|---|---|
| `id` | id for play, heard and events |
| `title` | short label (default: id) |
| `titles[]` | translations of the title: `{ lang, text }` rows (e.g. `{ lang: pt-BR, text: "..." }`) |
| `speakers` | entity names, in order |
| `lines[]` | `{ by = index, text, hold?, languages? }` or `{ speaker = name, text }` (in code `by` also takes a name); `hold` default = reading time from the word count (1.8 to 7.5 s), plus a 0.35 s beat |
| `radius` | earshot metres from the line's speaker (default 7, or EarshotSettings `radius`) |
| `trigger` | `meet` / `place` / `manual` |
| `meetRange` | metres for `meet` (3.5) |
| `at`, `placeRadius`, `from`, `to` | `place`: entity name, metres (3), hours like `"21:00"` (wraps past midnight) |
| `repeat`, `cooldown` | once only by default; `repeat: true` plays again `cooldown` s (30) after it ended |
| `key` | the line that counts as heard (default: last) |
| `grants` | strings given to listeners |
**Translations.** Each player reads a line in their own language, two ways, no code: a `text` (or `title`) of the form `"@<namespace>.<key>"` reads that line of a catalog (`/locales/<lang>/<namespace>.json` in the world; catalogs inside another package are not visible to earshotKit), or the line carries its translations inline, `languages: [{ lang: pt-BR, text: "Psiu. Fala baixo." }]` (the `text` is the English fallback). The ear meter's words come from `earshotKit.package/locales` (en, pt-BR).
## Contents
- `api.module`: the public API. `core.module`: pure timing / trigger / clarity logic. `defs.module`: data loading. `runtime.module`: host stepping, listening, events, facing. `view.module`: the three looks and the meter.
- `EarshotHost.component` (synced state; spawned for you), `EarshotSettings.component` (style, radius, showMeter).
- `exchange.dataType` and three example exchanges in `exchanges/` (meet, place, manual) used by the demo.
- `earshotDemo.scene`: two townspeople meet in a square and gossip, an old man mutters at the well; walk close to listen.
- `earshotKitTests.testSuite`: the pure parts (line timing, triggers, cooldowns, clarity, data checks).
- Guide: `how-to-let-players-overhear-npc-conversations-and-eavesdrop-for-clues`.
## Limits
- Speakers are found by entity name (`entity.find`); give them unique names.
- Code-defined exchanges should be defined on every peer; the host also carries each line's text and speaker in its Sync state, so other peers still show lines of an exchange only the host defined.
- One run per exchange id at a time; different exchanges run side by side.
- Lines are text only (no voice clips).
# Mission Dossier: Contract Select, Briefing and Debrief Screens Kit
`missionScreens` draws the three screens a mission, heist, contract or quest game needs, in five crafted styles that swap with one setting:
| Screen | What the player sees | What the game gets back |
|---|---|---|
| **Select** | every mission with its target, location, mastery marks and best grade | `pick(id)` |
| **Briefing** | the orders, the target's portrait, known intel, and chips for a starting point, an outfit and gear (selected, locked behind a mastery level, or free), the crew's ready state | `choose(kind, id)`, `ready()`, `back()` |
| **Debrief** | rating lines that stagger in one by one, a total that ticks up, the grade stamped down, mastery gained and unlocks, the crew and a team grade | `replay()`, `select()` |
| **Leaving** | a short full-screen moment while the player slips away by an exit | `done()` after N seconds |
Styles (family `briefing` draws briefing + debrief, family `select` draws the select):
| id | family | look |
|---|---|---|
| `scroll` | briefing | aged parchment between wooden rollers, wax seal, inked oval portrait, ledger, red ink stamp |
| `caseBoard` | briefing | cork board, polaroid on a pin, intel index cards on red string, typed after-action report, stamp circle |
| `card` | briefing | compact phone-first card with a dark head band and a gold grade medallion (used on phones by default) |
| `board` | select | weathered plank notice board of torn pinned bills under a lamp |
| `list` | select | clean dark list with framed portraits and Play buttons |
Every style fits 1280x720, 1920x1080, a 390x844 phone and an 844x390 landscape phone; phone buttons are at least 48px; buttons are focusable for gamepad and the first one takes focus; reduced motion shows everything at once.
## Use it
```luau
local Screens = require("missionScreens.screens")
local Samples = require("missionScreens.samples") -- invented models to try it with
require("missionScreens.styleScroll"); require("missionScreens.styleCaseBoard"); require("missionScreens.styleCard")
require("missionScreens.selectBoard"); require("missionScreens.selectList")
Screens.configure({ sound = function(name) mySounds.play(name) end }) -- optional: click, hover, open, stamp, leave
require("missionScreens.registry").configure({ briefing = "caseBoard", select = "list" })
Screens.briefing(Samples.briefingModel(), {
choose = function(kind, id) --[[ start / outfit / gear ]] end,
ready = function() end,
back = function() end,
})
```
`Screens.build(kind, model, styleId?, { w, h }?)` returns the widget tree without showing it (previews, galleries, tests). `Screens.configure({ screen, env, layer, idPrefix, phoneCard, sound, resolve })` lets a game keep its own screen id, callback env, button id prefix (default `ms_btn_`, giving `ms_btn_ready`, `ms_btn_pick_<id>`, `ms_btn_<kind>_<id>`) and its own style registry (`resolve(family, id?, ctx)`).
## The model
Plain data, in the game's own words. A mission (`contract`): `id, title, location, client?, brief, targets = {{ name, title, portrait?, description }}, intel = {{ title, text, source }}, starts/outfits/gear = {{ id, title, text }}, mastery = { thresholds }`.
- select: `{ contracts = {{ contract, level, best }}, host, lexicon? }`
- briefing: `{ contract, mastery = { level, best }, choices = { level, starts, outfits, gear } (rows with locked, need), knownIntel, choice = { start, outfit, gear = {ids} }, ready, others = {{ name, ready }}, live, host, lexicon? }`
- debrief: `{ contract, result = { display = "rank"|"letter"|"stars"|"team", grade, tier, tierIndex, tiers, tableTitle, total, unit, lines = {{ label, value, points, kind = base|bonus|penalty|info }}, failed }, mastery = { xpGained, xp, level, levelBefore, unlocked, nextAt }, team?, crew, allDone, host, lexicon? }`
`lexicon` renames the screen words (`contract`, `target`, `intel`, `start`, `outfit`, `gear`, `begin`, `replay`, `waiting` and the rest in `words.module`): a heist game passes `{ contract = "Job", target = "Mark" }`. A word the model does not name comes from the catalog.
## Words
Every word the screens print comes from the model or from `locales/en/missionscreens.json` and `locales/pt-BR/missionscreens.json` (namespace `missionscreens`). A world overrides any line by putting the same key in its own `/locales/<tag>/missionscreens.json`.
## Parts
`screens.module` controller · `registry.module` styles · `widgets.module` shared builders · `words.module` words · `styleScroll`, `styleCaseBoard`, `styleCard`, `selectBoard`, `selectList` · `samples.module` · `missionScreensTests.testSuite` · guide `how-to-show-a-mission-briefing-and-debrief-screen`.
Used by Sealed Orders (package `assassinationKit`; its `assassinationKit.screens` module is a thin adapter over this one).