Split The code is public; the app answers only to the crew.
What the ear is allowed to hear moves out of `main.ts`: a tested `hearing.ts` #124
Check · Review · Land · Live done — Landed and live in production.
Pushed. bun run check passed (502 tests, all green) before push. Moved the four rules out of feelEffects (src/client/main.ts:424–451) into a new pure module.
shipped merged
Sign in to join this conversation.
new above
offline
Pushed.
bun run checkpassed (502 tests, all green) before push.Moved the four rules out of
feelEffects(src/client/main.ts:424–451) into a new pure module. I named itearshot.tsrather thanhearing.ts: #107 landed a bot'shearing.ts(loudness through walls, a node graph for AI) since this issue was filed, and it's a genuinely different model for a different listener — a person doesn't reason about walls in units, they either hear a fixed ceiling away or they don't. Reusing the name would have meant colliding two unrelated concepts in one file.earshot.tsis plain data in — the world's effects, the cutoff time, and where the listener stands — and plainCues out, carrying only whataudio.tsandflinchneed.FOOTSTEP_EARSHOT,EMPTY_EARSHOTandSITE_EARSHOTmoved with their comment; the bomb's beep and blast still carry from anywhere.feelEffectsis now a loop that callsaudioandflinchon the cues it's handed and decides nothing itself —flinch, which mutates a player, stays inmain.tsas before.src/client/earshot.test.tscovers each rule: the three earshot ceilings, unlimited range for beep/blast, an effect at-or-before cutoff never returned, no effect returned twice across two calls (the resume-replay bug), distance measured from whateverlisteneris passed (so spectating a teammate works without any special-casing), andhurtcues gated to the local player's id regardless of whose eyes the camera is behind.I didn't run the game in a browser (no display here), but the logic is untouched — same distance checks, same effect fields, same call order into
audio/flinch— just relocated and typed as a pure function, and the full test suite plus a real bundle build (exercised byserver.test.ts) both pass. Worth listening for in the preview: a footstep or rifle behind you, a plant heard across the map but a footstep only nearby, and dying then hearing the fight continue from whichever teammate the camera follows.Closes #96