Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage metropolisUi.package·originates fromworld 0a0b119f-a…

app

The interface as one object the game talks to: mount it, feed it, listen to it.

byzero-proxy @ DESKTOP-DB3UJOJ·posted 11d ago
What it does

app

The interface as one object the game talks to: mount it, feed it, listen to it.

It owns the engine screens (one per screen module, each on its own layer), rebuilds a screen only when its data
changed, ages notifications and banners, turns widget callbacks and menu controls into actions, and asks the
input system for prompt glyphs. The screen modules stay pure; this is the only module here that calls `ui.*`.
NOT YET RUN IN THE ENGINE.

  local App = require("metropolisUi.modules.app")
  App.mount({ text = Copy.get })            -- registers the theme; `text(key, vars)` is the game's copy
  App.setHud(view, { prompts = { { control = "interact", text = "Hold to sign", hold = 0.4 } } })
  App.notify({ icon = "brush", text = "Clean. The fish-market wall, Old Quay.", tone = "good", seconds = 5 })
  App.banner({ name, rule, line, colour })  -- a district's name across the top for four seconds
  App.show("pause", data)   App.update("pause", data)   App.hide("pause")   App.isOpen("pause")
  App.input("down")                         -- menu controls: up, down, left, right, confirm, back, tabPrev, tabNext
  local off = App.on(function(action, payload) end)    -- "pause:resume", "settings:set:music" { value = 0.4 }, ...
  App.tick(dt)                              -- every frame (the component does this), also while paused
  App.unmount()

Screens: "hud", "escaped" (drawn in play), "mission", "caught", "map", "shop", "pause", "settings", "title" (menus).
App.menuOpen() says whether any menu is up, so the host knows when to activate its menu input map.

The interface is documented in the header of init.luau; this file repeats it for the asset browser.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

metropolisUi.modules.app — the interface as one object the game talks to: mount it, feed it, listen to it. It owns the engine screens (one per screen module, each on its own layer), rebuilds a screen only when its data changed, ages notifications and banners, turns widget callbacks and menu controls into actions, and asks the input system for prompt glyphs. The screen modules stay pure; this is the only module here that calls `ui.*`. NOT YET RUN IN THE ENGINE. local App = require("metropolisUi.modules.app") App.mount({ text = Copy.get }) -- registers the theme; `text(key, vars)` is the game's copy App.setHud(view, { prompts = { { control = "interact", text = "Hold to sign", hold = 0.4 } } }) App.notify({ icon = "brush", text = "Clean. The fish-market wall, Old Quay.", tone = "good", seconds = 5 }) App.banner({ name, rule, line, colour }) -- a district's name across the top for four seconds App.show("pause", data) App.update("pause", data) App.hide("pause") App.isOpen("pause") App.input("down") -- menu controls: up, down, left, right, confirm, back, tabPrev, tabNext local off = App.on(function(action, payload) end) -- "pause:resume", "settings:set:music" { value = 0.4 }, ... App.tick(dt) -- every frame (the component does this), also while paused App.unmount() Screens: "hud", "escaped", "subtitle", "wheel" (drawn in play), "mission", "caught", "map", "shop", "pause", "settings", "title", "rules" (a district's rule card), "decision", "board", "crew", "roster", "garage", "impound", "journal" (menus). The data of each is what modules.present makes from the game's views (see the screen module's header). App.menuOpen() says whether any menu is up, so the host knows when to activate its menu input map.

screenId(name: string) → string

argtypedescription
namestring

frame( ) → any

The layout frame for the canvas as it is now.

glyph(control: string) → any

The prompt glyph for a control on the device in use (nil when it cannot be read).

argtypedescription
controlstring

env( ) → any

render(name: string) → void

argtypedescription
namestring

mount(opts: any) → void

Register the theme and get ready to draw. `opts.text(key, vars)` is required. Pass `hosted = true` when a component owns the callbacks (MetropolisUi.component does); otherwise the app registers its own callback env.

argtypedescription
optsany

onCallback(id: ?, data: ?) → void

argtypedescription
id?
data?

unmount( ) → void

setHosted(hosted: boolean) → void

Tell the app a component is its owner (so it does not also register a callback env).

argtypedescription
hostedboolean

on(fn: (string, any) → void

Subscribe to actions. Returns a function that unsubscribes.

argtypedescription
fn(string, any

dispatch(action: string, payload: any?) → void

A widget callback or a menu action: every listener hears it.

argtypedescription
actionstring
payloadany?

isOpen(name: string) → boolean

argtypedescription
namestring

menuOpen( ) → boolean

Whether a menu screen (one that takes the controls) is open.

show(name: string, data: any) → void

Open a screen with its data (see each screen module's header for the contract).

argtypedescription
namestring
dataany

update(name: string, data: any) → void

Replace an open screen's data. Ignored when it is not open.

argtypedescription
namestring
dataany

hide(name: string) → void

argtypedescription
namestring

setHud(view: any, extra: any?) → void

Give the HUD this frame's view. `extra.prompts` lists what the controls do here.

argtypedescription
viewany
extraany?

notify(note: any) → number

Add a notification. Returns its id.

argtypedescription
noteany

banner(b: any) → void

Show a district banner for `b.seconds` (default 4).

argtypedescription
bany

setPatterns(on: boolean) → void

argtypedescription
onboolean

topMenu( ) → string

The topmost open menu, or nil.

input(action: string) → void

A menu control. Moves the selection of the top menu, or chooses, or backs out, as callbacks would.

argtypedescription
actionstring

tick(dt: number) → void

Advance: ages notifications and the banner, and redraws what changed. Call every frame, paused or not.

argtypedescription
dtnumber

peek( ) → any

For tests: the notifications and banner as they stand, and the open screens' data.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ 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".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.