Brodgar client

hafen API Reference

Every hafen.* namespace, one page each, and a directory where a namespace is large. Start with the conventions, then find the name in the tables below. Every page in the tree is listed here.

Page Holds
Conventions The grammar, snapshots vs handles, filters, nil, and the permission model.
Threading Where each handler runs, which trees it may reach, and the refusal when it reaches too far.
References Every kind of thing a verb takes: a Gob, a kin, a slot, an asset, an item, a widget, a selector.
Shapes What a plain table of numbers looks like: places, pixels, sizes, spans, colours, ids and units.
Data types Every snapshot shape a read hands back, field by field.
hafen.session The logins this client holds, the one on screen, and the world and character that hang off one.
hafen.event The hub: subscribing, the closed keys and the open ones.
The catalogue Every event the client fires, and what each hands your handler.
The message streams A message on its way to the server, and an update on its way in.

The snapshot shapes

Page Holds
The client An addon the client discovered: its manifest fields, its status, and the reason behind one that is not running.
The session and the world One login, an object in it, the people beside you, the ground, a place, your own things standing there.
The item and what holds it One item, and what a container states about its inside.
The character sheet Attributes, food, learning, movement speed, quests, wounds, buffs.
The fight A manoeuvre, a card in the deck, the action-point budget, a saved school, an opponent, an opening, a combat action.
The map A pin on the recorded map, a minimap icon category.
The widget layer A widget, a HUD meter, the open recipe, a hotbar slot, an action-menu entry, a chat channel and its lines.

The event families

Page Holds
Your addon and the sessions Your addon loaded, ticked and disabled. A character connecting, reaching the world, taking the screen, ending.
The world A game object coming and going, what is attached to one, a click on an entity of your own.
The character and the rosters Meters, buffs, food, study, equipment, action bar, wounds, kin, quests, map pins, the radial menu, Steam.
The chat A channel appearing, going away or taking the tab, and a line landing in one.
The fight An opponent joining a fight or leaving it, the numbers between you moving, the target changing, a manoeuvre used, an opening drawn and taken away, the combat row changing.

Reading the world

Page Holds
session:world One character’s live world: the objects it has loaded, the terrain, and the clicks and drags on both.
Gob One object in the world, read with methods.
Look How a gob is drawn: gob:scale(k), gob:visible(flag), gob:tint(color), gob:outline(color, width), client-local and written on the object.
Materials The variable-material slots a gob is drawn in: read the server’s, dress one in another resource, release it.
Placing The ghost on the cursor: what you are about to place, where it sits, the ground it will take.
Position The one place type, computable and saveable, that every spatial verb takes.
Overlay What is drawn at a gob: the game’s own, the labels and painters you attach, what you stood there.
hafen.map The map you have explored, kept on disk.
Segments and grids The shape of the database, the one Grid entity both halves hand back, storing a place.
Overlays The recorded claim and province masks, and the switches that draw them.
Drawings A grid as an image handle: the minimap picture, its levels, its cache.
Markers The map pins: reading them, adding your own, the Position one travels as.
Icons The minimap icon registry: which gob icons are drawn, and which announce themselves.

The player and character

Page Holds
session:player One of the characters you are logged in as, its own Gob, the walk and the cursor.
hafen.time The game clock, the day, the night and the season.
session:char Attributes, learning points, weight, food, skills, credos, lore.
session:study The study window: the curiosities in it, their LP and attention.
session:party The party roster, in party sequence order.
session:chat The chat channels, the one on screen, the lines in them, saying a line.
session:buff The buffs on the buff bar.
session:meter The HUD meter bars.
session:kin The kin roster, and the writes that add, rename and re-group.
session:speed The crawl, walk, run and sprint selector.
session:craft The open recipe window, and its Craft button.
session:quest The quest log, current and completed, and a quest’s objectives.
session:wound The wounds on the Health and Wounds tab, as a tree.
session:fight The manoeuvre-deck builder, and the fight in progress: every opponent, the numbers between you, the openings drawn beside each side, the combat row, and the writes that act in the fight.
session:actionbar The hotbar: read a slot, use it, assign one, hold one for an entry of your own.
session:menugrid The action menu: every action the character knows, invoking one, entries of your own.
session:flowermenu The radial menu one character has open: its petals, picking one, a petal of your own, whether it is painted.

The verbs that act are on the pages of what they change, under a Write (protected) heading with the key beside the verb. The catalogue of keys is permissions.

The UI

Page Holds
hafen.ui The hub: what is on screen, and the reading order.
Custom Your own windows and bare rectangles.
Overlays Painting over the screen, or over one widget, without owning either.
Mirror A surface showing another widget’s live picture: a character nobody is looking at, seen from the layer.
Controls What a control is, the roster, the reading order.
Display controls A label, a picture, a separator, a progress bar.
Interactive controls A button, a text entry, a checkbox, a radio, a slider, a scroll, a scrollbar, a key button.
Columns and rows A surface that lays its children out along one axis and sizes itself to them.
Lists A listbox, dropdown or menu of rows, and the row source they share with a radio.
The Widget object What every widget answers, subscribing on one, tooltips and focus.
Writes Which writes owned and borrowed widgets take, and greying out one you built.
The mouse Where the pointer is, what is under it, the modifier keys, the grab that makes a drag yours.
The pixel The unit every coordinate and size is measured in, and the scale in force.
Selectors Naming a widget: the grammar, the lookups, roles, hit-testing, the inspector.
Items The items the client draws, found through the icons that draw them.
Contents What one item holds, and how a stack differs from a bucket.
Container An item entering or leaving a container.
Native widgets Placing and hiding the client’s own widgets, handing one to the user to drag or size, and the restore.
Regions The widgets standing for what the client paints by hand: moving and hiding the combat display’s elements.
Edit Changing one part of one of the client’s windows: taking over what a control does.
Replace Waiting for a widget to appear, and standing your own window in its place.
Drawing The graphics wrapper: shapes, images, text, and the cache text goes through.

The stylesheet

Page Holds
The sheet hafen.ui():sheet(), one widget’s own rule, the cascade, where skinning ends.
Keys Site keys and tree keys: which surfaces a rule reaches, and what each honours.
Surfaces Every surface the client ships, and what it does with a rule.
The chat The chat window, its kinds of line, and the colours it walks.
The HUD’s plates The surfaces the client blits whole, and the property that replaces one.
Text font and color.
Chrome bg, border, padding, picture, and a window’s ornaments.
Geometry position, size, anchor and margin.

The files your addon ships

Page Holds
hafen.asset One loader for every file in your folder (images, fonts, models, data), the sandbox, interning.
The collection Loading, listing and freeing your files, and naming what a folder holds.
The handles What each kind of loaded file answers.
hafen.font A font handle: the built-ins, your own .ttf, drawing with it.
hafen.resource The client’s own resources by name, their layers, and the writes that change them.

Your own things in the world

Page Holds
hafen.virtual The anchor, the place a thing keeps, the shared verbs, the switch for the whole section.
Ghosts The game’s own props, standing where you put them, translucent and tinted.
Sprites A PNG in the world: facing modes, clicks, following a gob.
Models A glTF model: the subset that loads, the object’s verbs, clicks.
Widgets A window standing in the world: facing, clicks, standing the client’s own.
Patches A shape lying flat on the terrain: place, look, border, clicks.
Pieces The convex rings a patch is the union of: what a ring may be, the budget, taking one up.

The client itself

Page Holds
hafen.client The settings the Options window edits: performance, interface, video, audio, camera, client. The frame rate and the heap.
Addons and libraries Every addon the client discovered; export a table, read another addon’s.
Keybindings The hotkey registry: declare your own, read or remap any.
Your addon’s options The options your addon declares, and the page it fills.
Profiling Arming the frame profiler, and reading a frame and its history.
The counters Memory, net, loader, render, what stands in the world, the other sessions, the text cache. Readable with profiling off.
Attribution Who spent the frame: addons, your own scopes, widgets, passes, GL, the overhead.

Infrastructure

Page Holds
hafen.timer Run a function later, once or repeatedly.
hafen.store Your addon’s one file, the shapes it holds, when it is written and closed, the sandbox, the caps.
Vars A live table you name at var, saved for you: the scopes, what survives, the placements saved for you.
Tables A record: the builder, the Table and its rows, the types both ways, how a declaration evolves.
Statements SQL: :exec and :query, binding, what is refused, :transaction.
hafen.json Parse and encode JSON.
hafen.http Fetch a URL, against the host allowlist the user approved.
hafen.websocket Keep a connection to a server on that allowlist, speak on it and hear what it says.
hafen.voice A link to a proximity voice server on that allowlist, the declaration it needs, what the server is told, the limits.
The link Building a link, opening it, what it says, what is live, ending it.
The mic and the mix What you send and what you hear: the settings, whether you are speaking, the counters.
Peers The players a link relates you to, addressed by Gob, and the keys that follow them.
hafen.locale What the client displays: one catalogue of what to draw for the text it would have drawn.
hafen.console Register a :name console command, and run a line at one character’s console.
hafen.log Print a line to the console and the terminal.
hafen.sound Play a sound effect, stop it, ask what is still playing.
hafen.steam The Steam client under the game: the player’s identity, and the achievements it holds.

Getting started builds a first addon in about ten minutes.