Log inGet started
Package

hud.module

This package holds more than this page lists. See all of its files in its world.

README.md

horrorKit.hud

The horror HUD for this engine's own player: one screen, six looks switched by one value (bare, minimal, classic, scifi, vhs, diegetic). It shows health (SecondWind), rounds in the gun and spare (weaponsKit), torch battery or fuel (flashlightKit), keys and keycards (interactKit), a hotbar strip (inventoryKit), a damage flash and low-health pulse, pickup and hint lines, the objective, a safe-room badge and an optional dread hint (tensionKit). Every kit is reached through a soft link, so a world without one simply shows nothing for it.

Who calls it: the HorrorHUD component starts it and ticks it (HUD.start, HUD.step, HUD.stop); the horrorKit api and any game script call HUD.message, HUD.objective, HUD.setSafe, HUD.setStyle.

local HUD = require("~horrorKit.hud")
HUD.setStyle("vhs")
HUD.message("Picked up a red keycard", 3)
HUD.objective("Restore power to the pump room")
HUD.setSafe(true)            -- in a safe room
HUD.setElement("dread", true)

Calls: setStyle, style, styles, setElement, setElements, elements, message, clearMessages, objective, currentObjective, setSafe, isSafe, setVisible, setScale, setTarget, setSource(kind, fn), refresh, state, start, stop, step, isRunning. Constants: STYLES, ELEMENTS, DESCRIPTIONS, PALETTES, SCREEN (horrorKit_hud), LAYER (39, under interactKit's prompts).

Cost: data is sampled ten times a second; the screen is rebuilt only when a shown value changes (the VHS tape clock once a second). Motion (ECG sweep, blinking, noise bands, pulses, fades) is CSS animation the engine runs. While running it hides weaponsKit's ammo panel, flashlightKit's meter, interactKit's carried strip (setCarriedStrip) and Lifeline's own player bar, and restores them on stop.

Layout: scale follows the shorter screen side (0.72 to 1.5) inside the safe area. On a touch screen it reads the engine's touch control rects, controlsKit's and weaponsKit's buttons, and leaves the lower corners to the stick and the action buttons.