soundscape
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->
soundscape
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->TODO: describe this module.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2audio/soundscape.module — OWNED BY THE AUDIO SLICE. Toddler of Duty's whole soundtrack: a toy-band military menu theme and match loop, a backyard ambience bed, every weapon / pickup / hurt SFX and a gruff drill-sergeant announcer reading the lines dead straight. It is driven ONLY by game.rules: `Rules.on(...)` events (fire, botFire, hit, tag, throwPinecone, pineconeBoom, throwPoop, poopSplat, juice, phase) and `Rules.state` (phase, winner, inTimeout) polled in update(). It never writes Rules.state. Called by scenes/main.scene/entrypoint.luau: start() on load, update(dt) every frame, stop() on unload. start() is idempotent (no double subscribe). VOICE BUDGET. Nothing here uses playOneShot: every one-shot host is a new mixer track, and under a firefight those piled up until the mixer refused ("Failed to create spatial track ... maximum capacity"). Instead every sound plays through a FIXED set of long-lived Audio sources: * 4 non-spatial beds/decks: Music, Ambience, Announcer, Stinger * UI_VOICES non-spatial one-shot slots (the player's own pew, hurt, whistle) * SPATIAL_VOICES positional slots + FLY_VOICES looping fly clouds A slot is re-aimed (clip/volume/pitch/position) and re-played, and is stopped explicitly the moment its clip has played through. When every slot is busy the OLDEST voice of equal-or-lower priority is stolen; bot gunfire is the lowest priority, is rate-limited, capped at BOT_FIRE_MAX live voices, and culled past BOT_FIRE_RANGE from the listener.
note(what: string) → void
| arg | type | description |
|---|---|---|
| what | string |
title( ) → void
match( ) → void
win( ) → void
lose( ) → void
ambience( ) → void
pew( ) → void
pewAlt( ) → void
pineThrow( ) → void
pineBoom( ) → void
poopThrow( ) → void
poopSplat( ) → void
flies( ) → void
slurp( ) → void
waah( ) → void
whistle( ) → void
voDeploy( ) → void
voDown( ) → void
voPoop( ) → void
voWin( ) → void
voLose( ) → void
clip(key: string) → any
| arg | type | description |
|---|---|---|
| key | string |
durOf(key: string) → number
| arg | type | description |
|---|---|---|
| key | string |
ready(key: string, gap: number) → boolean
| arg | type | description |
|---|---|---|
| key | string | |
| gap | number |
toPos(p: any) → void
Accepts a vector, {x=,y=,z=}, {1,2,3}, an entity, or nil.
| arg | type | description |
|---|---|---|
| p | any |
listenerDist(p: { x: number, y: number, z: number }) → number
| arg | type | description |
|---|---|---|
| p | { x: number, y: number, z: number } |
spawnSource(name: string, fields: { [string]: any }) → void
| arg | type | description |
|---|---|---|
| name | string | |
| fields | { [string]: any } |
newSlot(name: string, fields: { [string]: any }) → Slot
| arg | type | description |
|---|---|---|
| name | string | |
| fields | { [string]: any } |
liveCount(slots: { Slot }, key: string?) → number
| arg | type | description |
|---|---|---|
| slots | { Slot } | |
| key | string? |
acquire(slots: { Slot }, pri: number, onlyKey: string?) → Slot
Free slot, else the oldest live slot of priority <= pri, else nil.
| arg | type | description |
|---|---|---|
| slots | { Slot } | |
| pri | number | |
| onlyKey | string? |
silence(s: Slot) → void
| arg | type | description |
|---|---|---|
| s | Slot |
fire(s: Slot, key: string, tag: string, vol: number, pitch: number, pri: number, p: { x: number, y: number, z: number }?) → boolean
Point a slot at a clip and play it once. tag is the voice-class key.
| arg | type | description |
|---|---|---|
| s | Slot | |
| key | string | |
| tag | string | |
| vol | number | |
| pitch | number | |
| pri | number | |
| p | { x: number, y: number, z: number }? |
play2D(key: string, vol: number, pitch: number?, pri: number?) → void
2D one-shot (the player's own sounds).
| arg | type | description |
|---|---|---|
| key | string | |
| vol | number | |
| pitch | number? | |
| pri | number? |
playAt(key: string, pos: any, vol: number, pitch: number?, pri: number?, tag: string?) → void
Positional one-shot (falls back to 2D with no position).
| arg | type | description |
|---|---|---|
| key | string | |
| pos | any | |
| vol | number | |
| pitch | number? | |
| pri | number? | |
| tag | string? |
applyMusicVolume( ) → void
announce(key: string, gap: number?) → void
| arg | type | description |
|---|---|---|
| key | string | |
| gap | number? |
setMusic(key: string?, vol: number?) → void
| arg | type | description |
|---|---|---|
| key | string? | |
| vol | number? |
onPhase(newPhase: string?) → void
| arg | type | description |
|---|---|---|
| newPhase | string? |
isPlayerVictim(victim: any) → boolean
| arg | type | description |
|---|---|---|
| victim | any |
victimPos(victim: any) → void
| arg | type | description |
|---|---|---|
| victim | any |
fire(_pos: ?, _dir: ?) → void
| arg | type | description |
|---|---|---|
| _pos | ? | |
| _dir | ? |
botFire(pos: ?) → void
| arg | type | description |
|---|---|---|
| pos | ? |
hit(victim: ?, _dmg: ?) → void
| arg | type | description |
|---|---|---|
| victim | ? | |
| _dmg | ? |
tag(_killerTeam: ?, _victimName: ?) → void
| arg | type | description |
|---|---|---|
| _killerTeam | ? | |
| _victimName | ? |
throwPinecone(pos: ?) → void
| arg | type | description |
|---|---|---|
| pos | ? |
pineconeBoom(pos: ?) → void
| arg | type | description |
|---|---|---|
| pos | ? |
throwPoop(pos: ?) → void
| arg | type | description |
|---|---|---|
| pos | ? |
poopSplat(pos: ?) → void
| arg | type | description |
|---|---|---|
| pos | ? |
juice(pos: ?) → void
| arg | type | description |
|---|---|---|
| pos | ? |
phase(newPhase: ?) → void
| arg | type | description |
|---|---|---|
| newPhase | ? |
voices( ) → void
start( ) → void
reap(slots: { Slot }) → void
| arg | type | description |
|---|---|---|
| slots | { Slot } |
update(dt: number) → void
| arg | type | description |
|---|---|---|
| dt | number |
stop( ) → void
stopAll(slots: { Slot }) → void
| arg | type | description |
|---|---|---|
| slots | { Slot } |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
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.