director
The campaign's flow for the local player: title -> level select -> story beat -> level -> results (+ the after-level beat) -> Next / Retry / map, and after the last level the finale hook, the finale words and the credits. Handles the per-player pause (Escape / P), the map's keys…
director
The campaign's flow for the local player: title -> level select -> story beat -> level -> results (+ the after-level beat) -> Next / Retry / map, and after the last level the finale hook, the finale words and the credits. Handles the per-player pause (Escape / P), the map's keys (arrows / WASD, Enter, Esc) and clicks, the results bar ("map (M)" or "the ending (M)" under the runner's results card), saving progress and the unlock toast, and keeps the right music piece playing. It draws nothing itself: it keeps the trees of its screens in Director.wanted() and rebuilds them only when the focus, the progress or the screen size changes; campaignKit.CampaignHost registers them. Games use it through campaignKit.api.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2nonstrict
now( ) → number return os
text(key: string) → string
| arg | type | description |
|---|---|---|
| key | string |
hook(name: string, ...: any) → void
| arg | type | description |
|---|---|---|
| name | string | |
| ... | any |
setState(s: string, info: any?) → void
| arg | type | description |
|---|---|---|
| s | string | |
| info | any? |
want(id: string, tree: any, layer: number) → void
| arg | type | description |
|---|---|---|
| id | string | |
| tree | any | |
| layer | number |
drop(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
wanted( ) → any return D
The screens the director wants up now: { [id] = { tree, layer, version } }. The host draws them.
screenSize( ) → void
localBody( ) → any
startPoint(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
moveBodyTo(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
keyEdge(slot: string, keys: { string }) → boolean
| arg | type | description |
|---|---|---|
| slot | string | |
| keys | { string } |
drawSelect( ) → void
hideAll( ) → void
showTitle( ) → void
showMap(focusId: string?) → void
| arg | type | description |
|---|---|---|
| focusId | string? |
chooseFocused( ) → void
beginLevel(id: string) → void
the story beat before the level, then the runner's own intro
| arg | type | description |
|---|---|---|
| id | string |
startFinale( ) → void
words( ) → void
afterResults(info: any) → void
the results card is up: the story beat after the level over it
| arg | type | description |
|---|---|---|
| info | any |
onFinish(ev: any) → void
a run ended: keep progress, play the stingers, open the next level
| arg | type | description |
|---|---|---|
| ev | any |
finished(levelId: string, result: any) → void
A custom runner's run ended: `result = { time, tier, coins, totalCoins, deaths, score }`. Keeps the best, then shows a menusKit results screen with Next / Retry / map.
| arg | type | description |
|---|---|---|
| levelId | string | |
| result | any |
drawResultsBar( ) → void
hookEvents( ) → void
on(evt: string, fn: (any) → void
| arg | type | description |
|---|---|---|
| evt | string | |
| fn | (any |
mon(evt: string, fn: (any) → void
| arg | type | description |
|---|---|---|
| evt | string | |
| fn | (any |
restart( ) → void
Restart the current level for the local player (no story beat).
tickPause( ) → void
tickSelect( ) → void
tickResults( ) → void
tick(_dt: number) → void
One frame of the director (the host calls it).
| arg | type | description |
|---|---|---|
| _dt | number |
callback(id: string, _data: any) → void
A click on one of the director's screens.
| arg | type | description |
|---|---|---|
| id | string | |
| _data | any |
configure(cfg: any) → void
Take a campaign config (see campaignKit.api) and get ready; the first screen comes up once the local player has a body.
| arg | type | description |
|---|---|---|
| cfg | any |
boot( ) → void
Boot: sound, save, story, menus, then the title (or the map).
status( ) → any
The local player's campaign state: { state, level, focus }.
config( ) → any return D
The config in use (nil before start).
runner( ) → any return D
The runner in use (nil before start).
look( ) → any return D
The resolved campaign look in use.
go(screen: string, levelId: string?) → void
Go to a screen: "title", "select" (focus on levelId), "level" (start levelId with its story beat), "finale".
| arg | type | description |
|---|---|---|
| screen | string | |
| levelId | string? |
setMapStyle(style: string) → void
Swap the level-select style on this machine ("storybook", "parchment", "lanterns", "list").
| arg | type | description |
|---|---|---|
| style | string |
shutdown( ) → void
Forget everything (tests, and when the host goes away at the end of play).
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.