Log inGet started
World

Powerplay: Abilities, Cooldowns and Status Effects Kit

README.md

hud

The UI side of abilitiesKit: ability bars and status icons in many layouts and five styles, plus the world-wide setting that "auto" components follow.

local Hud = require("abilitiesKit.hud")
Hud.renderBar("moba", "fantasy", AK.barView(), { scale = 1 })   -- a widget node; style.width/height = its size
Hud.renderEffects("buffBar", "pixel", AK.effectsView(), {})
Hud.setDefaults({ layout = "radial", style = "cartoon", statusLook = "chips" })
  • Renderers: renderBar(layout, style, view, opts) and renderEffects(look, style, effects, opts) are pure functions of the view. Pass "auto" to use the world default. measure(node) returns a node's size.
  • Catalogue: layouts() (hotbar, moba, radial, pips, orbs, touch), styles() (scifi, fantasy, cartoon, pixel, minimal) and statusLooks() (overhead, buffBar, list, chips) each return { id, label, description }.
  • Defaults: defaults() and setDefaults({ layout, style, statusLook, overheadLook }). AK.setUiStyle, AK.setBarLayout and AK.setStatusLook call setDefaults.
  • Live data: api(), localCharacter(), resolveTarget(target, fallback), barView(id), effectsView(id), isHidden(id) and cast(id, slot) wrap abilitiesKit.api and return nil while it is missing.
  • Placement: screenScale(W, H), safeArea(), touchRects() (controlsKit's on-screen buttons) and place(anchor, w, h, W, H, margin, avoid).
  • Drivers: barScreen(pub, W, H) builds an AbilityBar's full-screen tree, which the component registers itself so that its touch clicks reach it. StatusIcons components register with addStatus and removeStatus and share the screen abilitieskit_status (statusFrame, buildStatus).
  • Parts: Hud.Bar (uiBar), Hud.Status (uiStatus), Hud.Themes (uiThemes), Hud.Sample (uiSample) and Hud.Icons.

Touch buttons fire Hud.CAST_PREFIX .. slot ("abilitiesKit.cast:3"). castSlotFromCallback parses that callback id.