Log inGet started
World

First Light: Vagant

Branchmain
Branchesmain
Commit2ac9266a40

README.md

JaseyDirector

The Commissioners. This component builds them, drives them, and is the only place the rest of the game hears from them.

It sits on mount_jasey in scenes/main.scene and spawns nothing into the scene file: every Jasey it makes is a temporary entity built from jasey.model, and every one of them is local to this peer and unsynced. That is deliberate. fl.conspicuity() and fl.isHidden() are one vagant's answers about one lantern, so a shared set of hunters would be chasing several people with one set of senses. Every player on the fen gets their own five, which is also the only reading of the fiction that works — they come for whoever is carrying the light.

A Jasey is about seventy small pieces: legs and ruined boots, the flared skirts of a frock coat with a wet band at the hem, a narrow torso with tarnished buttons, arms that hang too long and end in a soaked cuff, two linen bands at the throat, a head that is a hole, and the jasey itself — a powdered dome, three tiers of curl massed round the back and sides, a rolled buckle over each ear, two lappets down the chest and a queue behind. They are built one a frame, because seventy entities times five in a single frame is the shape that makes a component's awake fail quietly.

Public fields

  • count: number — how many are out on the fen. 0 takes fl.TUNE.JASEY_COUNT.
  • running: boolean — drive them, or leave them where they stand. A staged beat turns this off to freeze the fen without removing anybody.
  • rustleVolume: number (0–1) — how loud the wig is at the listener's ear standing next to one. Scales with how fast the figure is moving.
  • wadeVolume: number (0–1) — how loud one is dragging itself through a cut.

Methods

  • :jaseys() — every Commissioner on the fen, as entity proxies.
  • :nearest(x, z) — the nearest one to a world point, and its distance.
  • :hunterCount() — how many are hunting the vagant this instant.
  • :report() — one row per Commissioner: mode, speed, wetness, hood glow and position. The read for a test or a debug pass.
  • :signals() — { hunt, lastHunt, caught, notice }, a tally of what this slice has told the rest of the game, so a test can prove a signal fired rather than infer it from a side effect.
  • :place(index, x, z, mode?) — stand one somewhere in a named state. Used to stage a beat and to put a Commissioner in a known place for a test.

Signals

Emits caught(jaseyEntity) once a Commissioner reaches an unhooded vagant, and hunt(count) whenever the number chasing changes — the HUD, the score and the fog all answer that one. Listens for lampLit (a share of the drifting ones walk to the new light) and phase (a fresh round puts everybody back where the night starts).

It asks the fen slice for fen.waterDepthAt(x, z) and, if the fen publishes one, fen.groundHeightAt(x, z). Neither is required: without them the Commissioners walk a flat dry fen.

Lifecycle

  • awake() — reads fl.TUNE, resolves its four clips, subscribes to lampLit and phase.
  • update(dt) — builds one Commissioner a frame until the set is up, then ticks every brain while the game is in the play phase.
  • editorUpdate(dt) — the same, but only while the gameplay clock is held, so a scene running unpaused in edit does not tick the same brains twice.
  • onDestroy() — unsubscribes and despawns every Commissioner.

Usage

local jd = entity.find("mount_jasey").component.get("JaseyDirector")
jd:report()                       -- what all five are doing
jd:place(1, 12, -8, "hunt")       -- stand one out on the fen, coming for you
jd.rustleVolume = 0.45            -- turn the wigs up