director
One-paragraph description of what this module provides and who consumes it.
director
One-paragraph description of what this module provides and who consumes it.
Exports
M.exampleFn(arg) -> result— what it does and when to call it.M.exampleValue: type— what value it carries.
Usage
Replace <identity> with the string asset.create returned — this
module's source path with / written as . and each segment's type
suffix dropped, the way a module at /source/lib/thing.module is
lib.thing and one at /source/kit.package/thing.module is
kit.thing.
local M = require("<identity>")
M.exampleFn("foo")
Notes
- Anything callers need to know about THIS module: required runtime ordering, state ownership, side effects.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2game.audio.director — music, ambience and sound effects for Amelia. local Audio = require("game.audio.director") Audio.init() -- once at play start; idempotent Everything else is driven by game.world.events, so other systems never need to require this module: Events.emit("music", "boss") -- crossfade (1.5 s) to a track; "none" stops Events.emit("sfx", "ui_confirm") -- one-shot (optional 2nd arg: volume 0..1) Events.emit("footstep") -- call every frame Amelia walks; throttled -- into a step cadence, surface from the area Events.emit("dialogueTyping") -- per revealed character; throttled blip Events.emit("ambience", "night_crickets") -- swap the ambience bed (nil = off) Events.emit("settingsChanged", { musicVolume = 0.8, sfxVolume = 1 }) Events.emit("battleExit") -- optional: results screen closed → field music now Handled automatically: areaEntered(id, def) → def.music (or the area default) + area ambience + soft chime; battleStart → battle_start sting + "battle" (unless "boss" was requested); battleEnd("win") → victory → field music resumes from where it paused; "flee" → flee sfx + field; "lose" → fade out. Mixer channels: "music", "ambient", "sfx". Volumes are channel levels, so the settings sliders reach sounds already playing. Public API: init, shutdown, playMusic, stopMusic, resumeField, sfx, blip, footstep, ambience, setNight, emitter, setVolumes, current, status.
resolveMusic( ) → void
resolveAmb( ) → void
resolveSfx( ) → void
refreshClips( ) → void
clipFor(kind: string, id: string) → any
| arg | type | description |
|---|---|---|
| kind | string | |
| id | string |
newDeck(name: string, channel: string, sourceType: string) → Deck
| arg | type | description |
|---|---|---|
| name | string | |
| channel | string | |
| sourceType | string |
setDeckVol(d: Deck, v: number) → void
| arg | type | description |
|---|---|---|
| d | Deck | |
| v | number |
runFader( ) → void
fadeTo(d: Deck, target: number, seconds: number, onSilent: string?) → void
| arg | type | description |
|---|---|---|
| d | Deck | |
| target | number | |
| seconds | number | |
| onSilent | string? |
activeDeck(group: { Deck }) → Deck
| arg | type | description |
|---|---|---|
| group | { Deck } |
freeDeck(group: { Deck }, except: Deck?) → Deck
Pick a deck for a new track: never one holding a kept (paused) field track.
| arg | type | description |
|---|---|---|
| group | { Deck } | |
| except | Deck? |
playOnGroup(group: { Deck }, kind: string, id: string, level: number, fade: number, loop: boolean) → boolean
| arg | type | description |
|---|---|---|
| group | { Deck } | |
| kind | string | |
| id | string | |
| level | number | |
| fade | number | |
| loop | boolean |
cancelVictory( ) → void
playMusic(id: string?, fade: number?) → void
| arg | type | description |
|---|---|---|
| id | string? | |
| fade | number? |
stopMusic(fade: number?) → void
| arg | type | description |
|---|---|---|
| fade | number? |
resumeField(fade: number?) → void
Bring the field track back (from where it paused, when it was kept).
| arg | type | description |
|---|---|---|
| fade | number? |
current( ) → string
ambience(id: string?, fade: number?) → void
| arg | type | description |
|---|---|---|
| id | string? | |
| fade | number? |
duckAmbience(on: boolean) → void
| arg | type | description |
|---|---|---|
| on | boolean |
sfx(name: string, volume: number?, pitch: number?) → void
| arg | type | description |
|---|---|---|
| name | string | |
| volume | number? | |
| pitch | number? |
blip(volume: number?) → void
Soft typewriter tick; throttled so calling it per character is fine.
| arg | type | description |
|---|---|---|
| volume | number? |
surface(areaId: string?) → string
| arg | type | description |
|---|---|---|
| areaId | string? |
footstep(surface: string?, volume: number?) → void
Call every frame (or every step) while Amelia walks; throttled to a cadence.
| arg | type | description |
|---|---|---|
| surface | string? | |
| volume | number? |
setNight(on: boolean) → void
Day/night for areas that have a night variant (Emberbrook).
| arg | type | description |
|---|---|---|
| on | boolean |
emitter(target: any, id: string, radius: number?, volume: number?) → any
A positional looping emitter on a scene entity (e.g. the town fountain). Returns the Audio component (remove it to stop). Heard within `radius` m.
| arg | type | description |
|---|---|---|
| target | any | |
| id | string | |
| radius | number? | |
| volume | number? |
setVolumes(musicVol: number?, sfxVol: number?, master: number?) → void
| arg | type | description |
|---|---|---|
| musicVol | number? | |
| sfxVol | number? | |
| master | number? |
onAreaEntered(id: string, def: any) → void
| arg | type | description |
|---|---|---|
| id | string | |
| def | any |
onBattleStart(_pool: any) → void
| arg | type | description |
|---|---|---|
| _pool | any |
onBattleEnd(result: string?, _pool: any) → void
| arg | type | description |
|---|---|---|
| result | string? | |
| _pool | any |
onSettings(s: any) → void
| arg | type | description |
|---|---|---|
| s | any |
init( ) → void
on(name: string, fn: (...any) → void
| arg | type | description |
|---|---|---|
| name | string | |
| fn | (...any |
shutdown( ) → void
Stop everything and remove the director's entities/handlers.
status( ) → any
rows(group: { Deck }) → void
| arg | type | description |
|---|---|---|
| group | { Deck } |
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 the 199 items nearest this part. It holds more than this page lists.
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.