Log inGet started
World

Verdigris Cloister

Branchmain
Branchesmain
Commit65770846aa

README.md

Hud

The in-mission interface of Verdigris Cloister. It mounts four screens on a 1080x1440 portrait frame, keeps them fed from the board, and answers clicks from the ability bar.

entity.spawn("HudRoot").component.add("Hud")
local hud = entity.find("HudRoot").component.get("Hud")

One instance is enough; it lives on its own root entity and needs no transform.

Where the board comes from

  1. the Director component's snapshot(), when the rules slice answers;
  2. otherwise a worked demonstration board, so the interface always draws something real. Turn that off with demoWhenUnbound = false.

What it draws

  • The initiative queue across the top: up to six painted portrait cards, front first, each with its monk's tint down the left edge, an HP bar, an overwatch mark, and a dagger over the dead. The wrap into next round is marked with a numbered divider, so the queue reads far enough ahead to plan against. Beside it, the round in roman numerals and the blight's share of the greenhouse.
  • The board overlay, which never takes pointer input: floating damage numbers with weight (a critical is bigger, brighter and slower), the destination chip naming the AP cost and the cover of the tile about to be entered, and a short banner when a phase turns over.
  • The inspector: the hovered tile's botanical plate, its name, its stage, its cover and elevation chips, and — set off in gold — what it becomes next round. When a shot is aimed it becomes the hit-chance stack instead: the honest percentage on a dial, and every modifier itemised line by line with its reason, then the damage range and critical chance.
  • The ability bar: the active monk and their AP pips, the six standing actions, that monk's own signature ability, Hold, and End Turn.

The surface other slices call

hud:hoverTile(x, y)             -- the pointer is over this tile
hud:clearHover()
hud:pinTile(x, y) / hud:unpinTile()
hud:previewDestination(x, y, apCost, cover, warn?)
hud:clearDestination()
hud:designate(attackerId, targetId, fallback?)   -- open the hit-chance stack
hud:clearTarget()
hud:selectAction(actionId, hint?)
hud:setActionStates({ burn = { usable = false, reason = "no action points" } })
hud:floatAt(unitId, text, kind, sub?)            -- damage / crit / heal / miss / death
hud:floatAtTile(x, y, text, kind)
hud:announce(title, sub?, tone?)
hud:report()                                     -- what it is drawing right now
hud:rehearse()                                   -- stage every state at once, for a look

Nothing is required. The picking slice owns hoverTile / previewDestination / designate; until it calls them the HUD finds the tile under the pointer itself, by projecting every tile centre and taking the nearest.

Signals it listens for

unitDamaged throws a number, unitDied a dagger, phaseChanged and roundBegan a banner, blightGrew a mark on the tile, unitSelected and unitActed clear the aim. It assumes no publisher exists.

Sounds it asks for

Through Core.sfx, by the names the audio slice publishes: ui_click on an ability, ui_confirm on end turn, unit_select on aiming a shot, ui_hover as the pointer crosses onto a new tile.

Callback ids

hud.action.<id> for every ability tile and hud.endturn. Each is a transparent button laid over the styled tile, addressable as hud-action-<id> and hud-endturn for gui clickElement.