five-on-it / packages/ai/src/visibility
packages/ai/src/visibility
How far one sees and hears in the room's light and weather (GAME_DESIGN §5.7: gently): a share of every sight range (a guard's and a camera's cone, a chaser's line of sight, a witness's reach) and of every hearing range.
- Night: where the room's sky darkens sight (
RoomWeather.night: a level that ships), the dark brings sight down to VISIBILITY.nightof its reach, eased through dawn and dusk (@foi/shared'sdaylightAt); under a street lamp (@foi/world'slampLightAt) only to.lamp. What counts is where the one seen stands: a player in the dark is hard to see, one under a lamp is not. A lamp knocked down (its light piece lying loose,@foi/sim'sisPieceLoose) is out: where it lit is dark again, until a level reset plants it. - Fog takes up to half of it away, rain a quarter in a downpour.
- Hearing: rain masks footsteps and shots, up to
.rainHearingof the range.
The client draws the cones with the same share (stealth-view.ts, the minimap). Deterministic: the clock, the weather the simulation read this tick (sim.sky) and the level.