# horrorKit
Everything a first-person survival-horror game needs, as one install: a light that throws real shadows and a battery you worry about, placed lights that flicker and die on cue, scripted events and a library of scares, a tension director that paces them and drives the music, heartbeat and screen feel, monsters that hunt you by sound and by your light, notes and tapes that tell the story, and the survival loop around them (scarce weapons, doors and keycards, supplies, safe rooms, save terminals and a HUD). Every style is one field. Built for multiplayer: two players see the same doors, monsters, lights and scares, and each has their own light, dread and HUD.
Version **1.0.21** (`Horror.VERSION`). horrorKit declares every package below in its `package.yaml`, so installing it brings each one at the version listed.
## What it installs
horrorKit is the umbrella. Each horror part is also its own package you can install alone:
| package | version | what |
|---|---|---|
| **flashlightKit** (was torchKit) | 1.0.4 | 12 handheld lights (classic torch, penlight, lantern, head lamp, phone, flare, glow stick, candle, dynamo, UV, camera flash, lighter), 11 battery types, recharge and swap, failures the story triggers |
| **eerieLightsKit** (was flickerKit) | 1.0.6 | 16 placed-light behaviours (dying fluorescent, guttering candle, swinging bulb, emergency red, alarm beacon, strobe, lightning, sparking, brown-out, sodium warm-up, TV glow, neon...), short-outs, power circuits, shadow-only figures |
| **scriptedEventsKit** (was cueKit) | 1.0.4 | triggers (area, look-at, pickup, door/interact, timer, chain, dread, event) playing ordered beats; once or repeating; remembered across death; host-decided for everyone |
| **scaresKit** (was scareKit) | 1.0.4 | 26 original scares rated 1 to 5 (knock, whisper, footsteps behind, shape crossing, lights die and it's closer, vent burst, door slam, power failure, body drop, chase sting...) |
| **tensionKit** (was dreadKit) | 1.0.4 | the tension director: 6 pacing styles, 6 screen looks, 5 audio palettes, music/ambience/heartbeat/breathing, a dread readout (F3) |
| **loreKit** | 1.0.6 | notes, memos, terminals, tapes with voice and subtitles, graffiti, data pads, photos, and a journal |
| **stalkerKit** | 1.0.10 | monsters on aiKit: pursuer, shambler, lurker, light-shy, blind hunter |
| **bulkheadKit** | 1.0.3 | rooms, corridors and props for station and ship interiors, used by the showcase room |
And the published kits it stands on, each declared with the version it is built and tested against:
| package | version | used for |
|---|---|---|
| aiKit | 1.4.0 | monster brains and senses, including carried lights (a flashlight gives you away) |
| navKit | 1.5.8 | monster movement |
| interactKit | 1.6.8 | doors, locks, keycards, switches, every use prompt |
| inventoryKit | 1.0.27 | the spare-battery bag and item strip |
| saveKit | 1.3.21 | checkpoints at save terminals, the lore journal |
| weaponsKit | 1.3.3 | the revolver, coach gun and flare pistol |
| SecondWind | 1.4.8 | health, first aid, death |
| Lifeline | 1.0.4 | respawn points |
| soundstage | 2.1.3 | music driven by the tension director |
| juiceKit | 1.2.12 | camera shake, sway and tremor |
| controlsKit | 1.4.9 | rebinding, prompts and touch buttons |
Not a dependency: **stealthKit**. The HUD has a light and noise element (`HorrorHUD.showStealth`) that draws whatever source a game hands it with `HUD.setSource("stealth", fn)`; the `horrorStealthLink` package passes stealthKit's readout there (place one `horrorStealthLink.StealthReadout`; this world's Brinefall scene does). Installing horrorStealthLink brings stealthKit with it; installing horrorKit alone does not. horrorKit itself never requires stealthKit, so installing horrorKit does not bring it.
Not a dependency either: **menusKit** (horrorKit draws no menu; Brinefall's ending screen uses it and declares it).
## First example
In a scene's `build.luau`, with a first-person player already set up:
```lua
local director = entity.spawn("HorrorDirector")
director.component.add("horrorKit.HorrorDirector", {
pacing = "survivalClassic", look = "grain70s", palette = "deepSea",
hud = "classic", torch = "classic", loadout = "revolver",
})
```
Press Play: every player carries a torch (F toggles, V shakes it back to life, B swaps a battery) and a six-shot revolver with a far-too-slow reload; dread builds in the dark and drives the music, heartbeat, breathing and screen; F3 shows the dread readout.
## The one-field styles
| field | values |
|---|---|
| `pacing` | slowBurn, rollercoaster, relentless, quietDread, survivalClassic, arcade |
| `look` | clean, grain70s, vhs, coldMonitor, sickly, bleachBypass |
| `palette` | industrial, deepSea, organic, synth, classic |
| `hud` | bare, minimal, classic, scifi, vhs, diegetic |
| `torch` | any flashlightKit style |
| `loadout` | revolver, coachgun, flaregun (comma separated) |
Per object: `LightBehavior.style`, `Stalker.kind`, `Lore.style`, `Scare.scare`, `interactKit.Door.look`.
## Components
| component | what |
|---|---|
| `HorrorDirector` | one per scene: the styles above; equips each player; runs the wiring |
| `HorrorHUD` | the HUD (the director adds it from its `hud` field) |
| `SafeRoom` | a box where dread pauses and drains, scares hold and monsters break off (`extents`, `label`, `blockMonsters`) |
| `SaveTerminal` | use it to save a checkpoint (saveKit), move your respawn here and recharge your light |
| `Supply` | `kind` = ammo, firstAid, bandage, battery; `amount`; per player by default |
## The wiring (`require("~horrorKit.api")`)
Loading `horrorKit.api` hands the optional kits to the horror kits that use them (`tensionKit.links`, `scriptedEventsKit.links`, `scaresKit.links`, `loreKit.links`): aiKit, SecondWind, soundstage, juiceKit, interactKit, inventoryKit and saveKit. The horror kits never require those by name, so each of them installs on its own with nothing extra; in a horrorKit game everything is linked with no call of yours (`Horror.linkKits()` repeats it).
`Horror.setup(opts)` (the director calls it) connects, on each player's own engine:
- the torch's visibility and beam -> the monsters (stalkerKit, through aiKit's carried light); its click -> a noise they hear;
- gunshots, doors and torch clicks -> monster noises and dread stimuli;
- monster threat, sightings and attacks, low battery and low health -> dread;
- scares -> asking the director first and reporting back (pacing);
- safe rooms -> dread pause and the HUD marker.
Also: `Horror.setSafe(on)`, `Horror.isSafe()`, `Horror.message(text, seconds)`, `Horror.objective(text)`, `Horror.localBody()`, `Horror.teardown()`, and every part as `Horror.Torch`, `Horror.Dread`, `Horror.Stalkers`, `Horror.Scares`, `Horror.Cues`, `Horror.Lore`, `Horror.Weapons`, `Horror.Interact`, `Horror.Arms`, `Horror.HUD`.
**Weapons** (`horrorKit.weapons`, on weaponsKit): `revolver` (6 rounds, 4.2 s reload), `coachgun` (2 shells, 5 s reload), `flaregun` (one flare that lights and burns). `Arms.give(body, "revolver,coachgun")`, `Arms.addAmmo(body, n)`.
## HUD
Six styles, one field (`hud` on the director, or `HorrorHUD.style`): `bare`, `minimal`, `classic`, `scifi`, `vhs`, `diegetic`. Health, ammo in the gun and spare, light battery, keys and keycards, items, a damage vignette, pickup and objective lines, the safe-room marker and an optional dread hint. Per player; scales for desktop, browser, tablet and phone and keeps clear of the touch controls.
| style | look |
|---|---|
| `bare` | nothing but the damage vignette, the low-health pulse and transient lines (objective, safe room, "Out of ammo", "Battery low" arrive as messages) |
| `minimal` | tiny monospace corner text that fades to a ghost after 3.5 s without change and comes back when something changes; warnings stay lit |
| `classic` | survival-horror status panel: an ECG line whose colour, rhythm and sweep speed follow FINE / CAUTION / DANGER, battery cells, a big ammo count, key and keycard icons |
| `scifi` | helmet visor: corner brackets, scanline wash, a vitals arc, PWR cell bar, a round counter with magazine ticks, ACCESS chips |
| `vhs` | camcorder OSD: blinking REC dot, HP level meter, the torch battery as the camera battery, CNT counter and tape time, date, tracking-noise bands that thicken and redden when hurt |
| `diegetic` | a leather wrist strap with two analogue dials (LAMP charge and PULSE, needles with red zones) and a clipped paper note: the objective as a to-do, rounds as hand-drawn tally marks, spare count, key tags |
Put `HorrorHUD` on any entity (the director adds one), or drive it from code with `local HUD = require("~horrorKit.hud")`:
| call | does |
|---|---|
| `HUD.setStyle(name)` / `HUD.style()` / `HUD.styles()` | switch the look; list them with descriptions |
| `HUD.setPalette(style?, overrides?)` / `HUD.palette(style?)` | recolour a look without replacing it (style defaults to the current one; `nil` overrides restores its defaults). Keys: `font`, `color`, `bg`, `shadow`, `accent`, `size`, `upper`, `radius`, `border`; the `classic` look also reads `accent` (objective bar), `objectiveLabel`, `objectiveText`, `battery`, `batteryLow`, `batteryDead`, `batteryDim` and `batteryOrientation` (`"horizontal"` default, or `"vertical"` for upright cells filling from the bottom). `HUD.PALETTES` holds them all |
| `HUD.message(text, seconds?, { color }?)` | a transient line (up to three stack; the same line again restarts it) |
| `HUD.objective(text?)` | the current objective (nil or "" clears) |
| `HUD.setSafe(on, label?)` | the safe-room / save badge |
| `HUD.setElement(name, on)` / `HUD.setElements(t)` | health, ammo, light, keys, items, vignette, messages, objective, safe, dread, stealth |
| `HUD.setVisible(on)`, `HUD.setScale(k)` | hide for cutscenes and menus; size multiplier |
| `HUD.setTarget(body?)` | show another body's data (spectating) |
| `HUD.setSource(kind, fn?)` | replace a data source (health, ammo, light, keys, items) for a game that keeps its own; `stealth` has no source until a game sets one (`fn` returns `{ light, class, threshold, noise, reach }`) |
| `HUD.state()` | what it shows now (tests) |
Data comes through soft links, so a missing kit just leaves its element empty: SecondWind (`HK.state`), weaponsKit (the local `Weapon`'s synced `ammo`/`reserve`/`reloading`), flashlightKit (`Torch.charge`/`switchedOn`/`spares`, and its `batteryLow`/`batteryDead`/`swapped` events), interactKit (the player's keys and keycards), inventoryKit (the hotbar) and tensionKit (`get`/`band`). While it runs it hides weaponsKit's ammo panel, flashlightKit's meter, interactKit's carried strip and Lifeline's own player bar (and Lifeline's vignette), and gives them back when it stops (`hideKitHuds = false` keeps them). It samples ten times a second and rebuilds only when what it shows changes (0 rebuilds a second while nothing changes); pulses, blinks, sweeps and noise are engine-run CSS animations. On a touch screen it moves out of the lower corners (movement stick, action buttons): sideways into a left column and beside the corner buttons, upright into one column down the left.
## Showcase room
One call builds a compact, dark room that shows the whole kit working: three placed lights, flashlight pedestals (`TorchStand`), a scare on an area trigger, a note, a safe corner with a save terminal, and a monster pen (`MonsterPen` keeps the monster in). Copy it into your own world to see the kit before you build with it.
```lua
local Showcase = require("horrorKit.showcase")
function content()
-- your scene and first-person player (Camera environment = "isolated"), with the new-world
-- template's `lighting` entity deleted: its sky lights the room even through an isolated camera
Showcase.build(nil, { at = { 40, 0, 0 } })
end
```
Options: `at`, `theme`, `director`, `monster`, `navMap`, `scare`, `stands`, `labels`, `name` (see `showcase.module/README.md`). `Showcase.label(parent, name, pos, yaw, title, opts)` draws a readable world-space label.
## Kit gallery
The horrorKit world also has a walkable gallery scene (`scenes.gallery`; a console in Brinefall's dive bay opens it, a button in its hub goes back): all 12 flashlight styles on pedestals, every battery type and failure mode on buttons, all 16 placed light styles, every light state with a circuit, a Silhouette and an Apparition, five monster pens and all 26 scares in booths that replay, each with a label. From code: `layers.load("scenes.gallery")`.
## Guides
- **How to make a horror game: light a dark room, build a scare, tune the tension and add a monster that hunts the player** (`horrorKit.package/how-to-make-a-horror-game-light-a-dark-room-build-a-scare-tune-tension-add-a-monster`)
- **Build a small horror level from an empty world, step by step** (`horrorKit.package/build-a-small-horror-level-from-an-empty-world`)
Open them with the `guides` tool or the Docs panel. Each package also carries its own guide.
## Example
**Brinefall Station** (the `brinefall` package in the horrorKit world): a 10–15 minute level in a flooded deep-sea research station, built from these parts and bulkheadKit.
## 1.0.21
On saveKit 1.3.21 (from 1.3.20) and controlsKit 1.4.9 (from 1.4.7): saveKit 1.3.21 is built against controlsKit 1.4.9 and menusKit 1.4.5, which no longer need the engine's deleted zui UI library; this world now states saveKit with its package.yaml. The Hold Your Breath world's entrypoint loads its dark theme through `ui.loadTheme` instead of requiring the deleted zui theme module, so the world loads and pushes on the current engine. No horrorKit code changes.
## 1.0.20
Published by a push that timed out with a 503 before the controlsKit pin was moved: it states saveKit 1.3.21 and still states controlsKit 1.4.7, which saveKit 1.3.21 does not bring. Use 1.0.21.
## 1.0.19
horrorKit's own dependency copy of barsKit carries barsKit's Showcase component in full again (661 lines). 1.0.18 bumped the showcase packages' versions but the restore itself did not reach main in that release, so its barsKit copy still shipped the empty file 1.0.17 had (found while releasing Low Water). No other change.
## 1.0.18
On scaresKit 1.0.5 (which states scriptedEventsKit 1.0.4) and saveKit 1.3.20. No horrorKit code changes.
## 1.0.17
On stalkerKit 1.0.10: a Stalker whose kind the game defines after it woke (a joining player's engine) waits for the kind instead of failing, so a second player's creature no longer loses its brain. No horrorKit code changes.
## 1.0.16
`Horror.clearRespawn(body?)` forgets which save terminal brings a player back, so a New Game respawns them at the level start until they use a terminal again (before, the terminal from the finished game stayed their respawn). HUD palettes take `objectiveFont`, the classic objective text's font family (default `ptserif`, unchanged), so a game can match its menu type. On saveKit 1.3.20 (`Save.clearCheckpoint()`).
## 1.0.15
SaveTerminal fix to 1.0.14: it wrote and read the respawn attribute by indexing the body's attribute proxy, which is sealed, so using a terminal only warned "respawn not moved" and the picker never saw a choice. It now goes through `attribute.set` / `attribute.get`. Verified in play with two terminals.
## 1.0.14
HUD palettes: `HUD.setPalette(style?, overrides?)` and `HUD.palette(style?)` recolour a look without replacing it; the `classic` look's objective bar (`accent`), objective label and text, and its battery cells (`battery`, `batteryLow`, `batteryDead`, `batteryDim`, `batteryOrientation` = `"horizontal"` or `"vertical"`) are no longer hardcoded. Defaults unchanged. SaveTerminal now really moves your respawn: every terminal's Lifeline spawn point starts switched off, using a terminal marks it on your body (attribute `horrorKitRespawnTerminal`), and a spawn picker brings each player back at the terminal they used last (before any save, Lifeline's own choice: the level's PlayerSpawn or any SpawnPoint the game placed). Before, every terminal's point was live from play start and Lifeline picked one at random. On loreKit 1.0.6 (subtitles setting), bulkheadKit 1.0.3 (surfaces no longer black under an isolated camera, `B.collect` for batching), flashlightKit 1.0.4 (torch follows the carrier when the main camera is elsewhere), stalkerKit 1.0.9 (`drowned` body, `appearAt` cancels a retreat) and scriptedEventsKit 1.0.4 (`call` beat takes `fn`). New HUD palette test.
## 1.0.13
On eerieLightsKit 1.0.6. The guide *Build a small horror level from an empty world* now turns the first-person rig to face up the corridor (`rig.localRotation = { 0, 1, 0, 0 }`; the camera starts from the rig's own pose) and lights the corridor brightly enough to see (tubeA 18, tubeB 14, cabinBulb 8, medTube 25). Contributed in pull request #2.
## 1.0.12
On eerieLightsKit 1.0.5 and stalkerKit 1.0.8. No code changes.
## 1.0.11
On eerieLightsKit 1.0.4 and stalkerKit 1.0.7. No code changes.
## 1.0.10
README only: the table of the kits it installs lists the versions 1.0.9 brings (eerieLightsKit 1.0.3, scriptedEventsKit 1.0.3, scaresKit 1.0.4, tensionKit 1.0.4); the 1.0.9 README still showed the earlier ones. No code changes.
## 1.0.9
While the horror HUD is up it also hides saveKit's own level and XP bar (and puts it back when it stops), so no "LV 1, 30 / 100 XP" bar appears in a horror game or pushes the condition and weapon panels. On flashlightKit 1.0.3, eerieLightsKit 1.0.3, scriptedEventsKit 1.0.3, scaresKit 1.0.4, tensionKit 1.0.4, loreKit 1.0.5 and stalkerKit 1.0.6.
## 1.0.8
On SecondWind 1.4.8 and stalkerKit 1.0.5, the SecondWind stealthKit 1.0.22 brings, so adding horrorStealthLink leaves one SecondWind in the world. No code changes; hudTests 11/11.
## 1.0.7
README: the stealth readout bridge, horrorStealthLink, installs into a fresh world now (stealthKit 1.0.20), so the README no longer calls it blocked. On SecondWind 1.4.7 (the newest SecondWind release) and stalkerKit 1.0.4. No code changes.
## 1.0.6
README: the stealth readout bridge says plainly that its fresh install is blocked upstream for now.
## 1.0.5
On loreKit 1.0.4 (its reader test no longer leaves engine errors). The stealth readout bridge, horrorStealthLink 1.0.2, now brings stealthKit 1.0.17.
## 1.0.4
Brings the fixed kits from the fresh-world check: eerieLightsKit 1.0.2, scaresKit 1.0.3, tensionKit 1.0.3, stalkerKit 1.0.3 (monster surfaces), loreKit 1.0.3, bulkheadKit 1.0.2.
## 1.0.3
- Depends only on the packages its own code uses: menusKit is no longer declared; SecondWind is declared at the release its references reach.
- `horrorKit.api` links the optional kits into tensionKit 1.0.2, scriptedEventsKit 1.0.2, scaresKit 1.0.2 and loreKit 1.0.2, which no longer require them by name (so none of them drags another kit into an install).
- The stealth readout link moved out of Brinefall into the new `horrorStealthLink` package.
## 1.0.2
- Installs into an empty world again: 1.0.1 recorded stealthKit 1.0.15 as a dependency (the HUD required its readout by name), and that release does not install into a fresh world, so `zeromind installAsset` refused horrorKit 1.0.1 everywhere. The HUD's stealth element now reads only a source the game sets (`HUD.setSource("stealth", fn)`).
- Darkness: the showcase snippet and the guides now say to delete the new-world template's `lighting` entity. Its sky lit a closed room to mean 37/255 with every light and the torch off, through an isolated camera; deleted, the same room reads 0.5/255.
- Cheaper frame: HorrorDirector re-asserts the own-body hider and the single touch Menu button 10 times a second instead of every frame (each pass walked the body's descendants and read the main camera).
## Multiplayer
Shared and host-decided: doors, keycards and locks (interactKit), placed lights (eerieLightsKit), cues and scares (scriptedEventsKit), monsters (stalkerKit on aiKit). Per player: torch and battery, dread and everything it drives, HUD, journal, supplies.
## Known limits
- Monster bodies are re-proportioned, re-skinned built-in humanoids with attached parts, not sculpted creatures (mesh generation was unavailable when this was made).
- The torch toggle (F) is also controlsKit's second interact key in its fps scheme; E stays interact.
# LightBehavior
Drives the point `Light`, spot `Light` or `SpotLight` on its entity. `style` picks the behaviour (16: dyingFluorescent, fluorescent, candle, fireplace, swingingBulb, emergencyRed, alarmBeacon, strobe, lightning, sparking, breathing, brownout, sodiumWarmup, tvGlow, neonStutter, steady). The synced `state` (on, off, flicker, short, restore) with `stateAt` is what triggers set; `group` tags and `circuit` names address lights for `eerieLightsKit.api`. Meshes on the entity and under it get the light's colour x level in shader-data lane 2 (wear `eerieLightsKit.fixtureGlow` to glow). Options: `intensity`, `styleColor`, `sound`, `volume`, `hang` (swing cord length), `shadows` (auto / always / never), `thunderDelay`, `seed`.
# scaresKit.Scare
One scare placed in the scene. Put it on an empty entity standing where the player will be when it fires, turned the way they will look, and pick `scare` (or `director` for a director-chosen slot). In play it builds the props and arms the cue; in the editor it previews the props. Fields: trigger, radius, seconds, lookAt, cueId, lights, door, text, players, once, maxIntensity, tags, options. Needs scriptedEventsKit installed.
# Apparition
A dark figure that exists only in a light's stutter. Link it to a LightBehavior (`light` = name or tag). While `armed`, when that light goes to flicker, short or restore, the figure shows in the lit frames (`showIn = "lit"`, a black shape against the light behind it) or the dark frames, for `window` seconds, then it is gone; `once` disarms it, `shown` counts showings. Every peer sees the same frames.
# horrorKit.SafeRoom
A box (`extents`, half-size in metres around the entity) where the local player is safe: dread pauses and drains, no scare fires, the HUD shows the safe marker and `label` is shown once on entry. With `blockMonsters` on, a stalker that follows a player inside breaks off and retreats. Put it on an empty entity in the middle of the room; pair it with a SaveTerminal.
# horrorKit.SaveTerminal
Something to use in a safe room (terminal, typewriter, tape deck). It adds an interactKit Interactable with `label`; using it saves the checkpoint `checkpoint` through saveKit, makes this the player's respawn point (a Lifeline SpawnPoint at `respawnOffset`), recharges their light if `recharge` is on, and shows "Progress saved". Put it on the entity the player looks at.
# Stalker
Turns a character into a horror monster. Put it on a synced entity and pick its kind (pursuer, shambler, lurker, lightshy, blind); it adds an aiKit Brain running the stalker brain with that kind's preset (bringing a navKit NavAgent and SecondWind health), builds and animates the creature's body on every screen, plays its sounds, sizes its hit volume for weaponsKit, and reports what it does through stalkerKit events. Fields: kind, lairGroup, active, sounds, volume; read-only mode, detail, target, hidden, pose, action.
# Silhouette
A figure seen only as its shadow. Put it on an empty entity between a light and a wall: the figure (`figure`, `tall`, `crawler`, `hand`) is built from primitives on the `fk_shadowOnly` render layer, which each player's main camera skips while shadow maps still draw it. `path` ('x,y,z; ...' local offsets), `speed`, `loop`, `hideAtEnd`; set `playing` (or `Lights.silhouette(target, "play")`) to walk it, started at the same session time on every peer. `shadowOnly = false` shows it as a black figure.
# horrorKit.HorrorDirector
Put one on any entity in a scene to make it a survival-horror game. Every style is a field: `pacing`, `look`, `palette` (tensionKit), `hud` (adds and drives a HorrorHUD on the same entity), `torch` (the flashlightKit style each player is given), `loadout` and `startAmmo` (horror weapons on weaponsKit), `music`, `debugDread`. Runs per player: equips the local player and calls `Horror.setup` / `Horror.tick` to wire torch, monsters, scares and dread together. Needs nothing beside it.
# horrorKit.MonsterPen
Keeps one monster inside a box. Put it on an empty entity in the middle of a pen, set `monster` to the monster entity's name and `extents` to the pen's half-size: whenever the monster is found outside the box it is put back where it started (on the peer that owns it, with its navKit agent warped too). Build the pen with real walls the monster's nav map cannot cross (1 m thick or more on a 0.5 m grid map); this is the guarantee on top, so a visitor at the rail is never reached. The showcase room and the kit gallery use it on every pen.
```lua
local guard = entity.spawn("penGuard")
guard.position = vector.create(7, 1.5, 86)
guard.component.add("horrorKit.MonsterPen", { monster = "penMonster", extents = { x = 3.6, y = 3, z = 1.6 } })
```
Fields: `monster`, `extents`, `every` (seconds between checks). Event: `returned { monster }`.
# StalkerLair
Marks a vent, crawlspace or dark hole that stalkers slip into to hide and heal and come back out of. Put it on an entity standing on the walkable floor in front of the opening, its forward (-Z) pointing in. Fields: group (only stalkers with that lairGroup use it; empty = all), kind (vent or dark), open. Draws nothing.
# horrorKit.TorchStand
A light pickup and style switcher. Put it on any entity (a pedestal, a shelf, a hook on the wall): it adds an interactKit prompt, and the player who uses it gets that flashlightKit `style` in their hand, restored, charged to `charge` and switched on (`switchOn`). Only that player's light changes. It needs the player to carry a `flashlightKit.Torch` (the `HorrorDirector` gives every player one).
```lua
local stand = entity.spawn("lanternHook")
stand.position = vector.create(2, 1.1, 4)
stand.component.add("horrorKit.TorchStand", { style = "lantern" })
```
Fields: `style`, `label` (empty: "Take the oil lantern"), `switchOn`, `charge`, `range`, `promptHeight`. Event: `took { style }`. The showcase room and the kit gallery use it for their light pedestals.
# Lore
Put it on any prop the player can read: a sheet of paper, a terminal, a dictaphone, a wall. Name a catalogued entry with `id`, or write one here (`title`, `body`, `clip` for a tape). `style` switches the reader with one field (`default` keeps the entry's own). With interactKit installed it adds an `interactKit.Interactable` beside itself (`label`, `range`, `trigger` look/proximity), so the player gets the standard Read prompt on keyboard, gamepad and touch; without it, E or the pad's west button opens it within `range`. Only the player who used it reads it. Event `read{id}`.
# kitGallery.layout
Builds the horror kit gallery at author time: `require("kitGallery.layout").build()` from `scenes/gallery.scene/build.luau`. It makes a hub, a spine corridor and seven halls of labelled bays (flashlight styles, batteries and failures, placed light styles, light states with a circuit, Silhouette and Apparition, monster pens, scares I and II), then calls `horrorKit.showcase` for the showcase room at the north end.
Interactive pieces are named so `kitGallery.runtime` can wire them in play: buttons `gbtn:<action>:<arg>` (battery, fail, flicker, charge, restore, state, circuit, silhouette, apparition, noise, scare), scare spots `gscare:<id>:<yaw>`, live state readouts `gstat:<lamp>`. Returns `{ root, spawn, halls, zEnd }`.
# kitGallery.runtime
The gallery's play-time wiring, called from `scenes/gallery.scene/entrypoint.luau` (`onLoad`, the play-mode load hook, every peer): `require("kitGallery.runtime").start()`.
- places every scaresKit scare at its booth (`gscare:<id>:<yaw>` spots) with a manual trigger; a booth button rebuilds the props and fires it again, as often as you like;
- wires every `gbtn:<action>:<arg>` button: flashlightKit batteries (`give` + `swap` + nearly empty), failures (`fail` for 6 s), story flicker, charge, restore; eerieLightsKit states (`setState`, returning after 6 s), the circuit (`circuit`), the Silhouette (`silhouette`) and the Apparition (re-arm + flicker); stalkerKit noises (`hearNoise` inside a pen);
- keeps the light-state readouts (`gstat:<lamp>`) current from `stateChanged`;
- wakes each monster pen (`Stalkers.setActive`) only while the local player is within 16 m.
`R.stop()` drops the wiring, `R.status()` reports what was wired and the last presses.
# eerieLightsKit 1.0.1, flickering, dying and swinging lights for horror levels
Named **eerieLightsKit** since 1.0.1 (it was published as flickerKit in 1.0.0). Search for either name.
Placed-light behaviours. Put **LightBehavior** on any entity carrying a point `Light`, a spot `Light` or a `SpotLight` and it drives that light: a dying fluorescent tube that buzzes and stutters, a bulb that really swings on its cord so the shadows sweep the room, a red emergency light, a rotating alarm beacon, lightning through a window with thunder behind it, a sparking broken fixture, and more. Every light carries a synced **state** (`on`, `off`, `flicker`, `short`, `restore`) that triggers and scripted scares set, by name, by tag, or by power circuit. Two shadow-reveal helpers come with it: a **Silhouette** that is only ever seen as a shadow on the wall, and an **Apparition** that stands in a doorway only while a light flickers.
## Install
Search ZeroMind for **eerieLightsKit** and install it, or copy `eerieLightsKit.package` into your world. No dependencies.
## First example
```lua
local lamp = entity.spawn("Hall_Light_01")
lamp.position = vector.create(0, 2.9, 0)
lamp.component.add("Light", { kind = "point", intensity = 8, radius = 9, castsShadows = true })
-- a glowing tube that lights up with the light and goes dark with it
local tube = entity.spawn("tube", { parent = lamp })
tube.localScale = vector.create(0.12, 0.05, 1.3)
tube.component.add("Model", { model = "@builtin::meshes.cube", material = "eerieLightsKit.fixtureGlow", castsShadows = false })
lamp.component.add(asset.resolve("eerieLightsKit.LightBehavior", "component"), { style = "dyingFluorescent", group = "hall", circuit = "wingB" })
```
```lua
local Lights = require("eerieLightsKit.api")
Lights.setState("Hall_Light_01", "short") -- spark, pop, dark
Lights.setGroup("hall", "flicker") -- every light tagged hall
Lights.circuit("wingB", false) -- the power dies
Lights.circuit("wingB", true, { stagger = 0.8 }) -- comes back one light at a time
Lights.on("stateChanged", function(e) print(e.entity, e.state) end)
```
## Styles
| style | what it does | colour | sound |
|---|---|---|---|
| `dyingFluorescent` | hums at 90 %, then bursts of rapid on/off with a ballast ping | cool white | tube hum loop, ping |
| `fluorescent` | strikes on with a stutter, then steady with a faint shimmer | cool white | hum loop |
| `candle` | gutters, dips, the flame position flutters | orange |, |
| `fireplace` | slow roll plus crackle flicker, moving light | deep orange | fire loop |
| `swingingBulb` | the light and its bulb swing on a cord (`hang` m) so shadows sweep the room | warm | chain creak loop |
| `emergencyRed` | dim, steady, slow breathe | red |, |
| `alarmBeacon` | rotates about its up axis (use a spot) | red-orange | klaxon loop |
| `strobe` | hard 7 Hz strobe | white | strobe ticks |
| `lightning` | dark, then rare double flashes through a window; thunder arrives 1–4 s later | blue-white | thunder |
| `sparking` | sputtering low light with bursts, sparks fly and bounce | white | crackle + sparks |
| `breathing` | slow pulse 12–100 % | (light's own) |, |
| `brownout` | sags with the power, occasional dips | dim amber |, |
| `sodiumWarmup` | from a pink glow to full orange over ~12 s after it comes on | sodium orange | ballast buzz |
| `tvGlow` | jumpy cuts between brightness levels | blue | static hiss |
| `neonStutter` | steady, then word-by-word stutters | magenta | neon buzz |
| `steady` | just obeys the state | (light's own) |, |
`styleColor = false` keeps the light's own colour. `require("eerieLightsKit.styles").define(id, { label, level = function(t, seed, since) ... end, color?, loop?, swing?, spin?, jitter?, sparks?, thunder? })` adds your own.
## States
| state | meaning |
|---|---|
| `on` | the style runs |
| `off` | dark (hum stops) |
| `flicker` | violent flicker over the style until changed |
| `short` | surge, spark shower, pop, then dark |
| `restore` | stutters back on over 1.8 s, then behaves as `on` |
A state carries `stateAt`, a session time: a change can be scheduled (`Lights.setState(t, "off", 2)` goes dark on every screen 2 s from now) and a circuit's lights come back staggered.
## API (`require("eerieLightsKit.api")`)
Targets are an entity, an id, a name, a glob (`"Hall_*"`) or a tag (a word in the light's `group` field or the entity's `tags` attribute).
| call | does |
|---|---|
| `Lights.setState(target, state, delay?)` | returns how many lights it reached |
| `Lights.setGroup(tagOrName, state, delay?)` | the same, for groups |
| `Lights.setStyle(target, style)` | switch behaviour |
| `Lights.circuit(name, on, { stagger, delay, short, from })` | power circuits: die together, come back one by one (nearest-first from `from`: a `{ x, y, z }` point, a vector, an entity or its name) |
| `Lights.point(p)` | the world point any of those forms names (nil when it names nothing) |
| `Lights.state(target)`, `Lights.levelOf(target)`, `Lights.list()`, `Lights.styles()` | reading |
| `Lights.silhouette(target, "play" \| "stop", delay?)` | start a Silhouette walking on every screen at once |
| `Lights.setQuality("high" \| "medium" \| "low")` | shadow budget 6 / 3 / 1 lights, update range 60 / 45 / 30 m |
| `Lights.on("stateChanged", fn) -> disconnect` | `{ entity, state, previous, style }` on every peer |
Entity-level contract (no require needed): set the `LightBehavior` fields `state` / `style` on the owning peer.
## Shadow reveals
- **Silhouette**, on an empty entity between a light and a wall. Its figure (`figure`, `tall`, `crawler`, `hand`) goes on the `fk_shadowOnly` render layer, which every player's camera skips while the shadow maps still draw it: you see a shadow slide across the wall and nothing that casts it. `path = "4,0,0; 4,0,-3"` (local offsets), `speed`, `loop`, `playing` (synced, started on every peer at the same session time). `shadowOnly = false` makes it a visible black figure.
- **Apparition**, a dark figure linked to a light (`light` = name or tag). While `armed`, when that light flickers, shorts or restores it shows in the lit frames (a black shape against the light, or in the dark frames with `showIn = "dark"`) for `window` seconds, then it is gone; `once` disarms it.
## Fixtures
Meshes on the light's entity and under it get the light's colour × level written to shader-data lane 2 every time it changes. Wear `eerieLightsKit.fixtureGlow` (unlit, emissive from that lane) or any instance-colour material on the tube / bulb / sign / screen and it glows when lit and goes dark when off, per lamp.
## Multiplayer
Placed lights are world state. The entity's owner writes `state`, `stateAt`, `style`; a change asked on any other peer is sent to the owner. Every peer computes the same flicker from the light's `seed` and `multiplayer.sessionTime()`, so all players see the same stutter, short and lightning flash with nothing sent per frame. Sounds and sparks are local to each peer, played from the same moments.
## Performance
About 0.07 ms of script per near light per frame (measured), less when nothing changes (the light is written only when its level moves). Lights farther than the quality's update range from the camera update twice a second. Only the nearest N shadow-casting lights (N = 6 / 3 / 1 by quality) keep `castsShadows`, re-picked twice a second. Sounds only play for near lights: a hum / fire / alarm loop exists only while the main camera (where the player hears from) is within its 18 m earshot (removed again past ~24 m), and a one-shot (ping, pop, spark, relay) is not started at all out of its earshot and is removed the moment its clip ends. Every live spatial source costs the engine a position sync each frame, so a level full of lights keeps only the handful you can hear (Brinefall Station: 21-34 live sources down to 13-19).
## Known limits
- The shadow-only trick edits each peer's main camera `renderLayers` (adds `!fk_shadowOnly`); a camera you create yourself needs the same token.
- Swinging, spinning and flame jitter move the light's own entity in play (the authored pose is the swing anchor); don't also animate that entity.
- `fk_relay` (restore click for non-fluorescent lamps) reuses the tube ping: the generated relay click was refused by the audio service.
## 1.0.1
Renamed from flickerKit. Fixture glow follows its light (a lamp whose Light is disabled counts as off). Lights update only as often as they need to (every frame within 20 m, 20 Hz beyond, 2 Hz past the cull distance, 4 Hz once settled) with no per-frame allocations. Quality is picked from the device; high is 4 shadow-casting lamps. Fixed a crash when entity positions came back as a proxy.
## 1.0.2
A registered light whose id is no entity (the test suite's stand-ins, or a light despawned while registered) no longer writes an engine error on every lookup; it is skipped quietly.
## 1.0.3
Leaving play is quiet: a light's cleanup removes its sound loop and sparks by id, only when they still exist, instead of reaching for entities the scene teardown already removed (that logged an error on every stop).
## 1.0.4
A light plays without errors before anyone listens: its sounds only look up where the listener stands when the listener names an entity that exists, so a scene with no player or camera yet (the first README example on its own) no longer logs "no entity with an empty id" every few seconds. Leaving play stays quiet.
## 1.0.5
A light plays and buzzes with no errors when nobody is listening yet. Its sounds now judge earshot from the main camera and never ask the audio system for its listener: that report snapshots the whole mix, and while no listener exists it names an empty one the engine logs about ("no entity with an empty id" every 2 to 4 s; 1.0.4 guarded the wrong step). With no camera at all a sound simply plays unculled. Leaving play stays quiet.
## 1.0.6
`Lights.circuit(name, true, { from = ... })` no longer crashes on a starting point given as `{ x, y, z }` (it read `from.x` only, so a list of three numbers, an entity name or an id stopped the restore, and a power-restored cue that called it never finished). `from` now takes a `{ x, y, z }` list, `{ x =, y =, z = }`, a vector, an entity, or an entity's name or id; a name that names nothing falls back to name order. New `Lights.point(p)` answers the world point any of those forms names. Contributed in pull request #2; the entity case and the test for every form were added on review.
# scaresKit
Named **scaresKit** since 1.0.1 (it was published as scareKit in 1.0.0). Search for either name.
**26 original horror scares, from a distant scream to a body dropping from the ceiling, each placeable with one call or one component and rated by intensity 1 (subtle) to 5 (huge).** Every scare builds its own props, plays its own generated sound, and runs as a [scriptedEventsKit](../scriptedEventsKit.package/README.md) cue, so it fires once for the whole multiplayer world and stays fired after the player dies and respawns. A tension director can list, pick, veto and hear every scare.
Version **1.0.5** (`Scares.VERSION`). The version, this README and `package.yaml` move together.
## Install
1. Install `scriptedEventsKit.package` and `scaresKit.package` (search ZeroMind for **scaresKit**; scriptedEventsKit is its one dependency). tensionKit (the director gate) and interactKit (the `interact` beat, door slams on an interactKit door) are optional: link them with `require("~scaresKit.links").link("tensionKit.api", require("~tensionKit.api"))` (same for `interactKit.api`); `require("~horrorKit.api")` links both.
2. `local Scares = require("~scaresKit.api")`.
3. In a scene entrypoint (or any code every peer runs in play): `Scares.place("doorSlam", { at = {0, 0, 5}, facing = 180 })`, or put a **Scare** component on an empty entity.
## First example
```lua
local Scares = require("~scaresKit.api")
-- the player walking into the spot (radius 2.5 m) fires it; props are built ahead of them
Scares.place("ventBurst", { at = { 4, 0, 9 }, facing = 90 })
-- lights die and something is closer each time, using the corridor's own lights:
-- hallStart and hallEnd are entities at the two ends of the corridor (your level has its own; these are spawned here)
local hallStart = entity.spawn("hallStart"); hallStart.position = vector.create(0, 0, 40)
local hallEnd = entity.spawn("hallEnd"); hallEnd.position = vector.create(0, 0, 52)
Scares.place("lightsCloser", { at = "hallStart", toward = "hallEnd", lights = "hallLight*" })
-- fire when the player LOOKS at the window for a second
Scares.place("handPrint", { at = { 0, 0, 20 }, trigger = { kind = "look", at = { 0, 1.5, 22.5 }, seconds = 1 } })
-- let the director choose what plays here, up to intensity 3
Scares.slot({ at = { -6, 0, 30 }, maxIntensity = 3 })
```
**Placement convention:** `at` is where the player stands when it fires; `facing` (yaw degrees, 0 = +z) or `toward` (a point or entity) is the way they look. Props are built ahead of them. The default trigger is an area of `radius` (2.5 m) at `at`; `mannequinTurn` uses a look trigger.
## The scares
| id | label | intensity | tags | props | what happens |
|---|---|---|---|---|---|
| `distantScream` | Distant scream | 1 | sound, distant, fakeout | | a scream far down the corridor ahead (`distance`) |
| `knock` | Knock on a door | 1 | sound, door, fakeout | | three slow knocks from behind `door` |
| `lightPop` | A bulb pops and dies | 1 | light, sound | lamp | the light above crackles, flares, dies, limps back (`lights`) |
| `shelfFall` | Bottle falls off a shelf | 1 | object, sound | shelf, bottle, cans | a bottle tips off a shelf and clatters down |
| `whisper` | Whisper in your ear | 2 | sound, personal, fakeout | | a whisper at the ear of the triggering player only (`text` optional) |
| `footstepsBehind` | Footsteps behind you | 2 | sound, personal, fakeout | | heavy steps right behind the player |
| `chairSlide` | Chair slides on its own | 2 | object, sound | chair | a chair scrapes across the floor and turns to you |
| `radioVoice` | Radio voice in the static | 2 | sound, object, lore | radio, crate | a dead radio crackles: a voice says something it should not know (`text`) |
| `waterSplash` | Splash in the dark water | 2 | sound, water, fakeout | ripple | something heavy goes under; rings spread |
| `breathingDoor` | Breathing behind a door | 2 | sound, door | | slow wet breathing behind `door` |
| `glassCrack` | Glass cracks | 2 | object, sound, glass | pane, cracks | a crack crawls across the window, line by line |
| `shadowSlide` | A shadow slides along the wall | 2 | light, visual, shadow | shadow | a tall shadow glides along a wall (`side`); eerieLightsKit Silhouette when present |
| `shapeCross` | A shape crosses the far end | 3 | figure, visual, corridor | figure | a tall wrong shape crosses the far end fast (`distance`, `width`) |
| `monitorFace` | Monitor shows a face | 3 | object, visual, screen, sound | desk, CRT monitor | a dead screen thunks on; a face of three dark dots resolves in the glow |
| `handleRattle` | Door handle rattles | 3 | door, sound, object | door | the handle jerks hard as if someone wants in (`door`) |
| `handPrint` | Hand print on the glass | 3 | glass, visual, sound | pane, hand | a wet palm slaps the glass and drags down; nobody there |
| `mannequinTurn` | The figure has turned | 3 | figure, visual, look | mannequin | look at it, look away, look back: it faces you, closer |
| `ceilingRun` | Something runs across the ceiling | 3 | sound, ceiling, fakeout | | thumps race overhead and away; the view shakes |
| `alarm` | Alarm blares | 3 | sound, light, loud | beacon | a red beacon spins and a klaxon tears the silence (`seconds`) |
| `doorSlam` | Door slams shut | 4 | door, sound, loud | door | the heavy door slams with a boom (`door` = an interactKit door to close, else its own) |
| `ventBurst` | Vent cover bursts open | 4 | object, sound, loud, vent | vent | a grille rattles, bangs off and clatters to your feet |
| `lightsCloser` | Lights die; it is closer each time | 4 | light, figure, visual | lamp, figure | out, back: a figure far off; out, back: halfway; out, back: right there; out: gone (`lights`, `marks`) |
| `pipeBurst` | Pipe bursts with steam | 4 | object, sound, loud, steam | pipe, steam | a pipe bangs and splits; steam blasts across the corridor |
| `powerFailure` | Power failure | 4 | light, sound, dark | lamp | everything winds down; seconds of black; emergency power stutters back (`lights`, `seconds`); sets flag `scaresKit.powerRestored` |
| `bodyDrop` | Body drops from the ceiling | 5 | object, loud, visual | body on a rope, lamp | a body in a stained sheet drops on a rope in front of you, jerks and swings |
| `chaseSting` | Chase sting | 5 | sound, personal, chase, music | | screeching hit and drums, red flash, view snaps toward `from`; sets flag `scaresKit.chase` |
All creatures, names and designs are original to this kit. The figure is a gaunt 2.3 m silhouette with overlong arms and a head tilted onto its shoulder.
Every scare has its own generated sound (`sounds/sk_*.soundClip`, 27 clips), registered with scriptedEventsKit by name so any cue can use them: `{"sound", "sk_doorSlam", at = "door"}`.
## Placement options
`at`, `facing` / `toward`, `trigger` (any scriptedEventsKit trigger), `radius`, `cueId`, `once`, `repeat` + `cooldown`, `times`, `players = trigger/all/near`, `when` (scriptedEventsKit conditions), `essential`, plus each scare's own needs: `lights`, `door`, `text`, `distance`, `width`, `marks`, `seconds`, `side`, `from`.
`essential = true` lets the scare skip the director's gate (tensionKit's pacing, or your own `setGate`). Use it for a beat the level depends on, such as a scare that releases a monster or that the finale chains from. A gated scare normally stays armed and fires once the director allows it. That only holds for a trigger that hits again, like an area or a look. A scare triggered by a pickup or a chained cue hits once, so it is essential by default: vetoed at that moment, it and everything chained after it would never happen.
## API
| call | what it does |
|---|---|
| `Scares.place(id, opts)` | build the props and arm the cue; returns the cue id |
| `Scares.remove(cueId)` / `placed()` / `trigger(cueId, force)` | manage placed scares |
| `Scares.get(id)` | a scare's card: `{ id, label, intensity, tags, props, needs, desc }` |
| `Scares.list({ maxIntensity, minIntensity, tags, without, gated })` | the library, filtered, sorted by intensity |
| `Scares.pick({ ...list opts, prefer = "random"/"strongest", exclude, seed })` | a director's choice among scares the gate allows |
| `Scares.setGate(fn(card) -> boolean)` | the director's veto, asked on the host before every scare fires |
| `Scares.useDreadKit()` | tensionKit as the director (once `tensionKit.api` is linked in `scaresKit.links`): `canScare` gates, `scared` hears every scare |
| `Scares.slot({ at, trigger, maxIntensity, tags, candidates, choose })` | a director-chosen slot |
| `Scares.on("scare" / "placed", fn)` | events, returns a disconnect |
| `Scares.sounds.CLIPS` / `names()` | the kit's sound refs |
## Events
| event | data |
|---|---|
| `scare` | `{ id, intensity, position = {x,y,z}, cueId, by }`, on every peer when a placed scare fires |
| `placed` | `{ id, cueId }` |
## Components
- **Scare**: one scare on an entity: `scare` (id or `director`), `trigger` (default / area / look / manual / timer), `radius`, `seconds`, `lookAt`, `lights`, `door`, `text`, `players`, `once`, `maxIntensity`, `tags`, `options`. Its props are previewed in the editor.
## Multiplayer
Place scares from code every peer runs (a scene entrypoint, a component): each peer builds the same props under the same names, and scriptedEventsKit's host decides the fire once and every peer plays the same beats from the same start time. Personal parts (whisper, footsteps behind you, flashes, shakes, the chase sting) go only to the players the cue targets (`players`).
## Known limits
- Props are procedural (primitive meshes with tinted materials); swap in your own art by hiding the kit's parts and animating yours with scriptedEventsKit beats.
- Falling and flying props are animated with easing rather than simulated, so every peer sees the same motion.
- The dark is the scene's: scares land hardest in a dim level where their lamps and lights carry the moment.
## 1.0.1
Renamed from scareKit; depends on scriptedEventsKit 1.0.1. Test suite renamed scaresKitTests.
## 1.0.2
Depends on scriptedEventsKit 1.0.2 (README fixes; cues defined from code stay defined across play sessions). The scares themselves are unchanged.
tensionKit and interactKit are linked through `scaresKit.links` rather than required by name, so scaresKit installs with scriptedEventsKit alone.
## 1.0.3
README: the first example spawns the corridor ends `lightsCloser` names (`hallStart`, `hallEnd`), so it runs as written in an empty world. The version test reads the right `package.yaml` path.
## 1.0.4
On scriptedEventsKit 1.0.3. No code changes.
## 1.0.5
On scriptedEventsKit 1.0.4. No code changes.
# bulkheadKit
Build derelict sci-fi interiors in code: research stations, ships, bunkers, submarines, labs, maintenance tunnels. One call builds a room or corridor with real doorway openings, door frames, structural ribs and ceiling beams, pipe runs, cable trays and trims; another places one of 30 procedural props. Six surface themes switch the whole look with one word. Made for horror levels (it builds the demo level of the horror kit in this world, *Brinefall Station*), and works for any interior.
Version **1.0.3** (`Build.VERSION`).
## Install
Search ZeroMind for **bulkheadKit** and install `bulkheadKit.package`, or `zero zeromind installAsset <guid>` in the shell. It needs nothing else: the surfaces it builds with ship inside it.
## First example
In a scene's `build.luau`:
```lua
local B = require("bulkheadKit.build")
function content()
local root = entity.spawn("Station")
B.useTheme("derelict") -- pale green bulkheads, grating, rusty pipes
-- a 3 m wide, 20 m long corridor with a doorway at its north end
local hall = B.room("hall", { x0 = -1.5, x1 = 1.5, z0 = 0, z1 = 20, h = 3.2,
openings = { { side = "N", at = 0, w = 1.6, h = 2.3 } } }, root)
-- a lab beyond it, in another theme
B.useTheme("clinical")
local lab = B.room("lab", { x0 = -6, x1 = 6, z0 = 20.3, z1 = 32, h = 4,
skipWalls = { S = true } }, root)
B.prop("labBench", { 0, 0, 25 }, 0, lab.root)
B.prop("tank", { -4, 0, 29 }, 0, lab.root)
B.prop("fluoro", { 0, 3.95, 25 }, 90, lab.root) -- ceiling fixture; put your Light under it
end
```
Two rooms that touch share one wall: give one of them `skipWalls` on that side and cut the doorway (`openings`) on the other.
## Rooms: `B.room(name, spec, parent?) -> { root, cuts, center, y, h }`
`spec` is the inner floor rectangle and what to put round it:
| field | meaning | default |
|---|---|---|
| `x0, x1, z0, z1` | inner floor rectangle, metres (+Z = north) | required |
| `y`, `h` | floor height and room height | 0, 3.2 |
| `wall` | wall thickness | 0.3 |
| `openings` | doorways `{ side = "N"/"S"/"E"/"W", at = centre along that wall, w, h, sill }` (a sill makes a window) | none |
| `skipWalls` | `{ N = true, ... }` sides left open (corridor ends, shared walls) | none |
| `ribs` | spacing of structural frames on the long walls and beams across the ceiling (0 = none) | 2.4 |
| `pipes`, `trays` | the pipe bundle along one long wall and the cable tray down the middle | on |
| `noFloor`, `noCeiling` | leave them out (pools, shafts, ramps, open sky) | off |
| `floor`, `walls`, `lower`, `ceiling` | a material or theme role for this room only | the theme's |
Walls have a dark lower band (`wallLower`) to 1.05 m, a skirting and a dado rail, and every doorway gets jambs and a header in the theme's `trim`. Walls and floors carry box colliders; decoration does not.
## Themes: `B.useTheme(name)`
| theme | walls | floor | for |
|---|---|---|---|
| `derelict` | chipped pale-green riveted bulkhead | rusty grating | research stations, the default |
| `hull` | dark bolted pressure hull | wet tread plate | docks, engine rooms, the deep parts of a ship |
| `clinical` | cracked white tile | studded rubber | med bays, labs, showers |
| `concrete` | damp stained concrete | grating | pump rooms, service tunnels, basements |
| `quarters` | green over wood laminate | rubber | cabins, offices, a mess |
| `industrial` | dark green over hazard stripes | tread plate | plant rooms, cargo holds |
The surfaces are generated PBR sets (colour, normal, roughness/metal) wrapped with the engine's world-space **triplanar** shader, so a 20 m wall and a 0.3 m jamb both tile at real size and nothing stretches. `B.material(roleOrName)` returns any of them for your own parts.
## Props: `B.prop(kind, pos, yaw?, parent?, opts?) -> group`
Every prop is built round its own floor point, facing -Z, and placed with `pos` and `yaw` (degrees). `B.propKinds()` lists them:
| kind | what | options |
|---|---|---|
| `locker` | row of steel lockers | `count`, `openIndex` (one door hangs open) |
| `bunk` | two-tier bunk with mattresses, blankets, ladder | |
| `desk` | steel desk, drawers, papers, lamp, mug, chair | `chair = false`, `chairYaw` |
| `chair` | swivel chair | |
| `crate`, `cases` | strapped crate; a stack of three cases | `size`, `mat` |
| `shelf` | four-shelf rack with boxes | `seed` varies the contents |
| `labBench` | steel bench, microscope, jars, tray, clipboard | |
| `console` | control desk, toggles, three CRT monitors | `screens = false` for dead screens |
| `tank` | cylindrical specimen tank with murky fluid | `height`, `fluid = false` |
| `pump` | pump housing, motor, plinth, pipes, valve wheel, gauge | |
| `gurney` | med-bay gurney with instrument trolley | |
| `gasTanks` | four chained gas cylinders | |
| `vent` | wall duct mouth whose grate is its own child entity `grate` (blow it off in a scare) | `size` |
| `fluoro` | caged double fluorescent fixture (tubes `tubeA`/`tubeB`) | `off = true` for dead tubes |
| `wallLamp` | caged bulkhead lamp | `glow` = glowRed, glowAmber, glowTube, glowCold |
| `hangingBulb` | bare bulb on a cord (`bulb`) | `cord`, `glow` |
| `valveWheel`, `hatchRing` | brass valve wheel; bolted pressure-hatch ring for a doorway | `size` |
| `divingBell`, `submersible` | hero props for a dive bay and a sub dock | |
| `bodyBag`, `papers`, `cable`, `barrel`, `table`, `puddle` | dressing | |
Lower level: `B.part`, `B.box`, `B.pipe(parent, name, a, b, radius, material?)`, `B.group`, `B.quatYaw`, `B.quatAxis`, `B.quatMul`. Rooms and props call `B.part` through the table, so wrapping it reaches everything they make.
## Batching: `B.collect(fn, body)`
Every prop part is its own Model entity by default. To batch, build inside `B.collect`: each visible part goes to `fn(part)` instead, as `{ parent, name, mesh, center, size, rot?, material, shadows, tint? }` (`center`, `size`, `rot` local to `parent`, the room or prop group entity, which is still spawned and placed). Parts with a collider still spawn an entity carrying only the BoxCollider; invisible helper parts never reach `fn`.
```lua
local parts = {}
B.collect(function(p) table.insert(parts, p) end, function()
B.prop("locker", { 1.2, 0, 6 }, -90, root)
B.prop("desk", { -1, 0, 4 }, 0, root)
end)
-- merge `parts` by material into your own meshes or one quickGeometry Group
```
## Multiplayer
Everything is plain scene content built at author time and baked into the scene, so every player loads the same station. Put moving or scripted things (doors, lights that fail) on synced entities with the kits that drive them.
## Performance
A room is ~40–120 primitive entities; a 10-room level is ~1,900. Props share a handful of materials. Fixture glows are emissive and cast no light; add real Lights only where they matter and keep shadow-casting lights few.
## Known limits
- Props are built from primitives (boxes, cylinders, tori, capsules), not sculpted meshes. They read well in the dark; up close they read as stylised.
- Ramps are a rotated box (`B.box` with a `rot`), so stairs are not modelled step by step.
- Rooms are axis-aligned rectangles.
## 1.0.1
Props use lit materials instead of tints, so nothing shows in total darkness. Fixture glow follows its light.
## 1.0.2
Ships a test suite, `bulkheadKitTests`: every theme and prop builds, unknown names are refused, doorways open, the README example builds (all dry runs, nothing lands in your scene).
## 1.0.3
Surfaces no longer render black under a camera with `environment = "isolated"`: the triplanar materials shipped `metallic: 1`, so every surface took its metalness from the packed texture at full strength and reflected nothing where there is no environment. Painted bulkheads, concrete, ceiling panels, tiles, rubber, hazard paint and wood are now `metallic: 0`; the rusty grating 0.25, the painted hull 0.3, tread plate 0.45, rusted pipe 0.2, dark steel trim 0.55 (brass stays 1). New `B.collect(fn, body)` hands visible parts to the caller for batching instead of one Model entity per part (colliders still spawn), and rooms and props call `B.part` through the table so a wrapper reaches them. The version test reads the package.yaml beside the install, so it passes under deps/ and showcase/ too. Two new tests.
# stalkerKit 1.0.2
Horror monsters that hunt the player. Put a `Stalker` on a character, pick a **kind** with one field, and it listens, follows your torch light, stalks you out of sight, hunts where it heard you, searches where it lost you, chases, attacks, and slips back into a vent when it is hurt or caught in your light too long, to come back later. Five kinds ship (pursuer, shambler, lurker, light-shy, blind hunter); each is plain data a designer tunes without code.
stalkerKit is built on **aiKit** (brains, senses, memory), **navKit** (movement) and **SecondWind** (health and damage). That means **weaponsKit** weapons hurt the monsters with no extra wiring, and every aiKit character hears the same noises.
## Install
Install `stalkerKit.package` from ZeroMind (search "stalkerKit" or "monster that hunts the player by sound and light"). It needs aiKit 1.4.0 or later in the world (aiKit brings navKit, SecondWind, Lifeline and MatchFlow); 1.4.0 is the release that adds carried lights (`AI.setCarriedLight`), which is how a torch gives the player away.
## First example
In code that runs in play on the host, once the level's colliders exist, with a navKit map baked over the floor (`require("~navKit.api").bake({ kind = "grid" })`, a frame or more after the walls are spawned; see Known limits):
```lua
local Stalkers = require("stalkerKit.api")
-- a vent the pursuer can slip into (stand it on the floor in front of the opening)
Stalkers.addLair({ -56, 0, -404 })
Stalkers.addLair({ -4, 0, -456 })
-- the hunter and a drowned diver
local pursuer = Stalkers.spawn("pursuer", { -25, 0, -412 })
local diver = Stalkers.spawn("shambler", { -20, 0, -430 })
-- your game hands over its own: here a stand-in player body, its camera's forward and a shot
local playerBody = entity.spawn("playerBody"); playerBody.position = vector.create(-25, 0, -420)
local cameraForward = vector.create(0, 0, -1)
local shooterBody, shotPosition = playerBody, vector.create(-25, 1.5, -420)
-- weapon fire, doors and torch clicks give the player away
Stalkers.hearNoise(shotPosition, "gunshot", shooterBody)
-- a torch kit says how visible a player is (0 dark .. 1 torch on) and where the beam points
Stalkers.setPlayerLight(playerBody, 1, cameraForward)
-- a tension director reads how close the danger is
local danger = Stalkers.threatFor(playerBody) -- 0..1
Stalkers.on("noticed", function(e) print(e.entity.name, "is after", e.target.name) end)
```
Or place it by hand: a synced entity with `stalkerKit.Stalker { kind = "pursuer" }` (it adds the aiKit `Brain` itself), and `stalkerKit.StalkerLair` on the entities in front of your vents.
## Kinds
| kind | look | senses | what it does | dies? |
|---|---|---|---|---|
| `pursuer` | tall, gaunt, too-long limbs and claws, pale wet skin, barnacle crusts, an eyeless elongated skull with a slit of needle teeth | sees only lit things (beyond 4.5 m), 24 m, 140°; hears 1.7× as far; notices a torch beam in its face from 16 m and a lit torch inside its cone from 36 m | the main hunter: hears shots, running, doors, torch clicks and thrown things; stalks out of sight at 8-14 m for up to 9 s, commits when you come close, shine your torch on it or it has watched long enough; chases, attacks (28 dmg); hunts and searches the last-known spot; after 5 s lit, 22% health lost in 6 s or 22 s of chasing it screeches and runs to the nearest vent, crawls in, heals for 16-30 s and crawls out of the vent nearest a player | no: at 20% health it retreats and heals |
| `shambler` | a drowned diver: bloated, in a rotting canvas suit, cracked brass helmet with a swollen face behind the porthole, lead boots, kelp | 9 m sight, poor hearing (0.8×), remembers for 40 s | slow (0.85 / 1.55 m/s), relentless (gives up after 12 s unseen), grabs and bites (34 dmg, slow), 360 HP, shrugs off small hits | yes |
| `lurker` | a darker, crouched pursuer thick with barnacles | 16 m, all round | waits motionless where you put it; moves only while no player is looking at it (freezes in your view); lunges from 3 m with a hiss; after a short chase melts back into a lair or the dark | yes |
| `lightshy` | pale pink skin with glowing blue spots on its skull | 18 m, notices beams | circles at 5-9 m at the edge of your light; a beam or strong light on it for 1.2 s makes it recoil to the nearest dark; strikes the moment you stand in darkness | yes |
| `blind` | grey-green, eyeless, a huge barnacle-crowned skull | hearing only, 2.2× (a walking footstep from 11 m) | goes where it heard; walk slowly (silent), throw something, or stand still | yes |
### Body styles (`stalker.body`, one field)
Every kind's look is its `stalker.body` knob, so any kind can wear any body: `pursuer`, `shambler`, `lurker`, `lightshy`, `blind`, and `drowned`.
`drowned` (new in 1.0.9): a tall (2.55 m), gaunt, long-limbed, hunched figure draped in river weed and dripping silt. Dark olive-brown silt skin that stays matte under a torch (roughness 0.88, metallic 0, almost no clearcoat), a dark elongated skull, long dark claws, no barnacles and nothing that glows. About 40 strands of weed hang from the head, shoulders, elbows, hands, back, hips and thighs; each hangs from gravity whatever the pose, bends in two segments and sways in `Body.update` (more while it moves), and a pool of 10 silt drops falls from the strand tips and is reused (parked while the body is hidden). Use it on any kind:
```lua
Stalkers.tuneKind("pursuer", { stalker = { body = "drowned" } }) -- every pursuer
Stalkers.defineKind("riverman", { base = "pursuer", stalker = { body = "drowned", sounds = "shambler" } })
```
Every kind is an aiKit preset (`stalker.<kind>`) plus a `stalker` table of knobs. Change them for the whole game:
```lua
local Stalkers = require("stalkerKit.api")
Stalkers.tuneKind("pursuer", { stalker = { stalkTime = 15, hideTime = { 40, 60 } }, preset = { move = { run = 5.6 } } })
Stalkers.defineKind("hound", { base = "pursuer", label = "Hound", preset = { move = { run = 7 } }, stalker = { stalk = false } })
```
### Knobs (`stalker` table)
| knob | pursuer | meaning |
|---|---|---|
| `drawnToLight` | 1 | 0..1: a lit torch inside its eyes' cone is a lead out to 36 m × this |
| `lightShy` | 0 | light level where it stands that it cannot bear (0 = never) |
| `litTolerance` | 5 | seconds in a beam / strong light before it breaks off (0 = never) |
| `attackOnlyInDark` | false | will not close in while the prey stands in light |
| `stalk`, `stalkRange`, `stalkTime`, `commitRange` | true, {8,14}, 9, 5 | keep its distance out of sight before committing |
| `huntRun` | true | runs to loud leads (gunshot, door, shout) |
| `chaseTimeout` | 22 | seconds of chase before it slips away (0 = never) |
| `searchTime`, `vanishAfterSearch` | 14, 0.5 | how long it searches; the chance it then slips into a lair |
| `retreats`, `hurtRetreat` | true, 0.22 | breaks off after losing this share of health within 6 s |
| `dies`, `floor` | false, 0.2 | false: never drops under `floor` health; retreats and heals instead |
| `hideTime`, `returnNear` | {16,30}, true | seconds in the lair; come out of the lair nearest a player |
| `lurk`, `freezeWhenWatched`, `springRange` | false, false, 3 | ambusher behaviour |
| `flinch`, `staggerAt` | 0.3, 30 | seconds a hit stops it; damage in one hit that staggers it twice as long |
| `grab` | false | slow grab-and-bite attack |
| `breathEvery`, `screechOnNotice` | {4,7}, true | feel |
| `body`, `sounds` | pursuer | which body and sound set it uses |
## API (`local Stalkers = require("stalkerKit.api")`)
| call | what it does |
|---|---|
| `Stalkers.spawn(kind, at, opts?) -> entity` | Spawn a synced stalker (`opts`: name, yaw, lairGroup, route, active). |
| `Stalkers.addLair(at, opts?) -> entity` | A vent / dark hole at a position, or on an entity (`opts`: group, kind = "vent" or "dark", yaw). |
| `Stalkers.sendTo(e, pos, { run })` | Send it to look at a spot. |
| `Stalkers.retreat(e)` | Break off now and slip into a lair. |
| `Stalkers.appearAt(e, pos, { face })` | It crawls out at a spot, then hunts toward the nearest player. Cancels a retreat still under way and releases a `holdHidden`. Orders sent in the same moment are all seen, in order; the last that changes what it does wins. |
| `Stalkers.holdHidden(e, on)` | Keep it in its lair until released. |
| `Stalkers.setKind(e, kind)`, `Stalkers.setActive(e, on)` | Switch kind; switch its brain off/on. |
| `Stalkers.hearNoise(pos, loudness, source?, kind?)` | A noise: metres or a name (`gunshot` 35, `slam` 22, `throw` 16, `door` 14, `run` 11, `impact` 10, `click`/`torch` 6, `footstep` 5). `source` = who gives themselves away. Goes through aiKit's noise bus. |
| `Stalkers.setPlayerLight(player, level, beamDir?, { range, cone })` | A torch kit reports a player's light (0..1) and beam; call it on the player's own peer. |
| `Stalkers.playerLight(player)` | The light as the monsters know it. |
| `Stalkers.threatFor(player) -> 0..1` | Danger for a tension director: nearest stalkers, what they do, whether they are after this player. Every peer. |
| `Stalkers.list()`, `Stalkers.info(e)`, `Stalkers.nearest(pos, { visible })` | What is out there. |
| `Stalkers.kindNames()`, `kind(name)`, `defineKind`, `tuneKind` | The kinds as data. |
| `Stalkers.on(event, fn) -> connection` | Events (below); call the connection or `:Disconnect()` to stop. |
## Events
| event | payload | fires on |
|---|---|---|
| `state` | `entity, state, from, detail`, state is `idle`, `stalk`, `hunt`, `search`, `chase`, `retreat` or `attack`; `detail` is the brain's own state (lurk, creep, recoil, vent, hidden, appear...) | every peer |
| `noticed` | `entity, target` | every peer |
| `lost` | `entity, target` | every peer |
| `attacked` | `entity, target, kind` (attack, grab) | every peer |
| `hurt` | `entity, amount, by` | the peer running it |
| `retreated` | `entity, lair` | the peer running it |
| `appeared` | `entity` | the peer running it |
| `died` | `entity, by` | the peer running it |
| `noise` | `position, radius, kind, source` | the peer that called hearNoise |
| `*` | `{ event, data }` | all of the above |
## Fighting them
Their health is SecondWind's, so weaponsKit's hitscan, projectiles and melee hit them (weaponsKit hits collider-less characters as a capsule; the Stalker sizes it to the creature: 2.3 m for the pursuer, 0.5 m wide for the shambler). A hit flinches them; one of 30+ damage staggers. The pursuer cannot be killed by default (`dies = false`): it screeches and retreats to heal, so ammo buys time, not safety. The shambler dies after about 360 damage. **Ammo is the level's job**: keep it scarce (a handful of rounds per encounter) so running, hiding in the dark and turning the torch off stay the better answer.
## Multiplayer
The host (or the entity's owner) runs the brains through aiKit; every peer builds the same body from the synced `kind` and animates it from the synced pose and one-shot counter, and plays the sounds locally, so nothing but a few fields crosses the network. Any player can be hunted. Torch reports go from each player's peer to the host through aiKit's carried-light channel. Scripted orders (`sendTo`, `retreat`, `appearAt`, `holdHidden`) work from any peer.
## Performance
Each stalker is one aiKit brain (senses 10×/s, thinks 15×/s) plus a skinned body with ~60-110 small parts and an AnimGraph ticked in script. A pursuer is roughly one aiKit character plus one animated body; two or three on screen are fine on a tablet. Parts cast no shadows where they are small. Lower `AI.config.senseRate` / `thinkRate` for weaker devices.
## Known limits
- **Nothing reports your torch to the monsters unless something calls `setPlayerLight`.** horrorKit does it for flashlightKit's torch; with flashlightKit alone, call `Stalkers.setPlayerLight(body, Torch.visibility(nil))` on the player's own peer a few times a second.
- **Switching the torch off does not shake a pursuer that already has you.** Measured in an empty world, twice: standing still in the dark with no lead, it never found the player (idle at 18 to 21 m for 20 s); with the torch on it noticed at about 14 m, stalked and caught the player within about 10 s; switching the torch off then (during the chase, or after sending it to a lair) did not lose it: it went to where it last knew the player and, since it sees an unlit player inside `darkRange` (4.5 m), found them and kept attacking. Put distance, a door or a hiding place between you before you go dark.
- **Bodies are a re-proportioned stock rig.** Mesh generation was out of quota when this was built, so every creature is the engine's rigged humanoid stretched, re-skinned and dressed with procedural parts. A generated or imported rigged creature can replace it in `stalkerKit.body` (`Body.STYLES`).
- **A hidden stalker keeps its hit volume at its lair.** Shots into an empty vent can still hit it.
- **Lurker "watched" check uses where each player faces** (the torch report's beam when there is one, else the avatar's turn), not the exact camera.
- **Bake the navKit map after the level's colliders exist**: a grid map baked in the same frame the walls were spawned has no walkable cells and every stalker stands still ("unreachable").
- **Vents are entry points, not paths**: a stalker vanishes into one and comes out of another; it does not crawl through ducts.
## Tests
`tools.use("tests", "run", { suite = "stalkerKit" })` (edit mode): kinds and presets, the API, hearNoise reaching aiKit's bus, events, threatFor, and a play test where a pursuer hears a gunshot and goes to it.
## Version history
- **1.0.0**: First release: five kinds, the stalker brain, the Stalker and StalkerLair components, bodies, generated animations and sounds, the api with noise, light, threat and scripting hooks, a guide and a test suite.
## 1.0.2
README only: how to bake the navKit map in the first example; that the torch reaches the monsters only through `setPlayerLight` (horrorKit or your own code); what a pursuer does when you go dark mid-chase.
## 1.0.1
Bodies use lit materials, so a monster in a dark room is invisible until a light finds it. Overhead health bars are off by default (`healthBar` field). `setActive` reliably wakes and stills a monster. Declares aiKit 1.4.0 and its other dependencies with versions.
## 1.0.10
A Stalker whose kind the game defines after it woke now waits for that kind instead of failing. A joining player's engine receives the creature before the game's start code defines its own kinds, and the Stalker used to hand aiKit the unknown preset at once, which threw ("aiKit.addBrain: unknown preset 'stalker.<kind>'") and disabled the component for good on that player's side. Now its brain and body are built as soon as the kind exists (`Kinds.has(kind)` is new). New test: "waits for a kind defined after it woke". Found in Low Water's co-op.
## 1.0.9 (`stalker.body = "drowned"`): tall, gaunt, long-limbed and hunched, draped in swaying river weed, dripping silt, matte dark silt skin, nothing glows. `appearAt` now always cancels a retreat in progress: orders queue until the brain next thinks instead of the later one overwriting the earlier, a non-retreat order clears the retreat and frees the lair it was heading for, and `appearAt` releases a `holdHidden` (a game no longer needs to switch the brain off and on to bring it out). New test "appearAt cancels a retreat in progress".
## 1.0.8
Correction to 1.0.7: its wait for the sky light does not prevent the occasional 6 "camera texture not found" errors during the in-play test, so it is removed. Those errors come from the engine, not this kit: switching into play makes the sky light build six internal capture cameras, the test runner's leftover sweep removes them when the test ends, and the sky light later draws through the removed cameras (reported to ZeroMind). The tests pass either way; a plain install and play logs none. No changes outside the tests and README.
## 1.0.7
The tests leave no camera errors: the play test restarts the sky light, and each test now ends only once the sky light has finished its capture, so the runner's cleanup never removes capture cameras with a picture still queued. No changes outside the tests.
## 1.0.6
The tests remove everything each test (and the monsters it spawned) left behind and wait for previews a fresh install is drawing, so a passing run leaves no errors. The second README example requires the API itself and runs on its own. No changes outside the tests and README.
## 1.0.5
Declares SecondWind 1.4.8, the version stealthKit 1.0.22 brings, so a world with both kits runs one SecondWind. No code changes; stalkerKitTests 7/7 on 1.4.8.
## 1.0.4
Declares SecondWind 1.4.7, the newest SecondWind release, which is what an install beside stealthKit 1.0.20 places (it stated 1.4.8). No code changes; stalkerKitTests 7/7 on 1.4.7.
## 1.0.3
Bodies keep their surfaces again on the current engine: each part's roughness, clearcoat and glow (the pursuer's eyes and spots, the diver's porthole) went to `Model:setMaterialProperties`, which now writes the shared material and failed on the kit's runtime materials (hundreds of warnings, flat parts). Parts and skins now get materials of their own with those values, made once per look; no shared material is ever repainted. README: the first example defines the player body, camera forward and shot it uses.
# loreKit
Version **1.0.6**.
Notes, documents and audio logs that tell your game's story. Put a **Lore** component on a prop and the player can read it: a full-screen **reader** opens in one of **seven styles**, switched by one field. Everything found goes into the player's **journal** with unread markers, saved per player through saveKit. Reading pauses nothing (the world keeps running for everyone), it closes with **Esc**, the pad's **B**, or a big **tap** target, and it is sized for phones and tablets. Ships nine original example entries, two generated voice logs and two generated photos.
## Install
Install `loreKit` from ZeroMind. It needs nothing else and installing it brings no other kit. It works with these when the game links them (`require("~loreKit.links").link("interactKit.api", require("~interactKit.api"))`; `require("~horrorKit.api")` links all three):
| Kit | Used for |
|---|---|
| interactKit | the standard Read prompt on a Lore prop (E / pad X-west / touch button, look-at or proximity) |
| saveKit | saving each player's journal (`Save.set("loreKit", ...)`) |
| soundstage | ducking music and ambience under a tape |
## First example
```lua
local Lore = require("~loreKit.api")
Lore.define({ id = "first_note", style = "note", title = "A torn page", body = "Don't run. It hears the grating." })
-- on a prop, in the editor: add loreKit.Lore, set id = "first_note" (or write title/body there)
-- or from code, on any prop (here a new one):
local prop = entity.spawn("tornPage")
prop.component.add("loreKit.Lore", { id = "first_note" })
Lore.on("read", function(e) if e.first then print("found", e.id) end end)
```
In play, walk up to the prop and press E. Press **J** (or the pad's View/Select, or tap the badge) for the journal.
## Reader styles (`style` = one field)
| Style | What the player sees and hears |
|---|---|
| `note` | handwritten italic on stained, creased paper, slightly askew; paper rustle |
| `memo` | typed office memo: letterhead, FROM / DATE / SUBJ, typewriter face, CONFIDENTIAL stamp |
| `terminal` | CRT terminal; green phosphor text types itself out with a blinking cursor (`variant = "amber"` for amber); beep and keys |
| `tape` | dictaphone deck with spinning reels, timer and progress; plays the entry's `clip` with tape hiss and timed subtitles (from `subtitles`, or made from the body's sentences); music ducks under it |
| `graffiti` | big rough red letters scrawled on a grimy wall |
| `datapad` | sci-fi tablet: bezel, glowing header bar, clean type |
| `photo` | pinned instant photo (`image`) with a handwritten `caption` |
`Lore.open(id, { style = "terminal" })` shows any entry in another style.
## Entries
`{ id, style, title, body, author?, date?, clip?, subtitles? = { { at, text } }, image?, caption?, variant? }`. `clip` is a soundClip ref (or a loreKit clip name), `image` a texture reference (or a loreKit image name).
Examples (original, a half-flooded deep-sea research station): `ring_c_note` (note), `curfew_memo` (memo), `sonar_terminal` (terminal), `tape_varga_14` and `tape_reyne_02` (tape, generated voices), `scrawl_light` (graffiti), `pad_manifest` (datapad), `crew_photo` and `camera_still` (photo, generated images).
## The Lore component
Fields: `id`, `style` (`default` or one of the seven), `title`, `body`, `clip`, `label` ("Read"), `range` (2.2 m), `trigger` (`look` / `proximity`). With interactKit it adds an Interactable beside itself; without it, E or the pad's west button opens it within range. Event `read{id}`. Only the player who used it reads it.
## API (`require("~loreKit.api")`)
| Call | Does |
|---|---|
| `define(entry)`, `get(id)`, `ids()` | the catalogue |
| `open(id, opts?)` | open the reader (finds + marks read + fires `read`). `opts.style`, `opts.source` |
| `close()`, `current()` | close the reader or journal; the open id |
| `find(id)` | add to the journal without opening (true the first time) |
| `markRead(id)`, `isFound(id)`, `isRead(id)` | journal state |
| `journal()`, `unread()` | `{ { id, title, style, read } }` oldest first; unread count |
| `openJournal()`, `toggleJournal()`, `resetJournal()` | the journal screen; a new game |
| `setSubtitles(on)`, `subtitles()` | this player's tape subtitles on or off (default on), for a settings menu; saved in their saveKit profile (`loreKit.settings`) when saveKit is linked; an open tape redraws at once. `open(id, { subtitles = false })` overrides it for one open |
| `STYLES`, `STYLE_INFO`, `VERSION` | |
## Events
| Event | Payload |
|---|---|
| `read` | `{ id, style, title, first, source }` |
| `found` | `{ id, title }` |
| `opened` / `closed` | `{ id }` / `{ id, seconds }` |
| `journal` | `{ open }` (or `{ loaded = true }` after saveKit loads it) |
| `settings` | `{ subtitles }` (and `loaded = true` when a saved choice was applied) |
## Input
| | Keyboard / mouse | Gamepad | Touch |
|---|---|---|---|
| Read | E (interactKit prompt) | X / west | Interact button |
| Close | Esc, Backspace, ✕ button, click outside | B / east | tap ✕ (56 pt tall) or outside |
| Journal | J | View / Select | tap the badge |
## Multiplayer
The reader, journal and badge are local to each player: reading pauses nothing for anyone, and only the player who used a Lore prop sees it. Each player's journal is their own and is saved in their own saveKit profile. Entries defined in code exist on every engine that runs that code.
## Known limits
- Without saveKit the journal lasts the session only.
- Tape subtitles made from the body are timed by sentence length; give `subtitles` for exact timing.
- The badge and journal key are fixed per host (`LoreHost.journalKey`, default J).
## 1.0.1
Escape closes only the open reader or journal; it no longer also opens the engine menu. Declares its dependencies with versions.
## 1.0.2
Installs alone: interactKit, saveKit and soundstage are linked by the game through `loreKit.links` instead of being required by name; `require("~horrorKit.api")` links them.
## 1.0.3
README: the first example spawns the prop it adds Lore to, so it runs as written.
## 1.0.4
The reader test no longer leaves engine errors behind: it removed the reader screen in the same frame it showed it (14 "parent never materialized" errors per run). It now lets each screen settle before closing it. The reader itself is unchanged.
## 1.0.5
The tests remove everything each test left behind and wait for previews a fresh install is drawing, so a passing run leaves no errors. No changes outside the tests.
## 1.0.6
Subtitles can be turned off. `Lore.setSubtitles(false)` hides the tape reader's timed subtitles for this player (a settings menu toggle), `Lore.subtitles()` reads it, and `Lore.open(id, { subtitles = true | false })` overrides it for one open. The choice is saved per player through saveKit (key `loreKit.settings`) when it is linked, an open tape redraws at once, and the `settings` event fires. Default unchanged (on). New test covers it.
# kitGallery
The horror kit gallery of the Hold Your Breath world: the scene `scenes/gallery.scene`, where a player walks a hub, a spine corridor and seven halls and sees every part of horrorKit working, each with a readable label in the world.
| hall | what is on show | how |
|---|---|---|
| 1 Flashlights | all 12 flashlightKit styles, one per dark bay | E on the pedestal: it is in your hand (`horrorKit.TorchStand`) |
| 2 Batteries and failures | all 11 battery types; brown-out, contact, sudden, sputter, flicker, step-down, gutter, story flicker, drain, recharge, restore | buttons act on the light in your hand |
| 3 Placed light styles | all 16 eerieLightsKit behaviours, one lamp per bay | walk past |
| 4 Light states | on, off, flicker, short, restore (each with a live readout), a four-lamp circuit dying and coming back, Silhouette, Apparition | buttons |
| 5 Monster pens | pursuer, shambler, lurker, light-shy, blind behind a wall, a 2.4 m strip and a rail | noise buttons, your torch, looking away |
| 6, 7 Scares | all 26 scaresKit scares in booths, intensity on each label | a button per booth, repeatable |
| north end | the horrorKit showcase room (`horrorKit.showcase`) | |
`kitGallery.layout` builds it at author time; `kitGallery.runtime` wires it in play. Open it with `layers.load("scenes.gallery")` (from code in play, or the scene toolbox's `load`).
## Changes
- The gallery entrypoint now uses `onLoad` (this engine has no `onLoadDefault`, so the runtime never started and no button worked); the Back to Brinefall Station button is baked into scenes.gallery (it was in the layout but the scene had not been rebuilt); the travel button loads the next scene from a system task so the root swap cannot cancel its own load.
- 1.0.7: on horrorKit 1.0.8.
## 1.0.8
On horrorKit 1.0.9.
## 1.0.9
On horrorKit 1.0.10.
## 1.0.10
On horrorKit 1.0.11.
## 1.0.11
On horrorKit 1.0.12.
## 1.0.12
On horrorKit 1.0.13.
## 1.0.13
On horrorKit 1.0.18 and bulkheadKit 1.0.3.
## 1.0.15
On horrorKit 1.0.20, which states controlsKit 1.4.7; use 1.0.16.
## 1.0.16
On horrorKit 1.0.21 (saveKit 1.3.21).