Skip to main content

Customize a farming HUD

You can replace the default farming HUD with a Lua module. The module receives a native snapshot and publishes a panel. It does not move the player or enforce harvest-health checks.

Start from the complete project template. Replace its hud.lua with the example below. Its main.lua already connects presentation = require("hud") to the farming session.

A complete BPS renderer

local M = {}

function M:update(snapshot)
local ready = snapshot.complete == true
local bps = math.floor((snapshot.bps or 0) + 0.5)
local tone = "muted"
if ready then
tone = bps < 15 and "bad" or bps < 19 and "warn" or "good"
end

hexis.hud.panel({
profit_footer = false,
status = { uptime = true, phase = snapshot.phase },
sections = {
{
rows = {
{
kind = "metric",
label = "Harvest rate",
value = ready and tostring(bps) or "–",
unit = ready and "BPS" or "",
tone = tone,
},
},
},
},
})
end

return M

What this code displays

SnapshotPanel readingMeaning
complete = falseHarvest rate –The averaging window is not ready
Ready, bps = 0Harvest rate 0 BPS, bad toneA measured zero, not missing data
Ready, bps = 14Harvest rate 14 BPS, bad toneBelow this renderer's target
Ready, bps = 18Harvest rate 18 BPS, warning toneNear the target
Ready, bps = 20Harvest rate 20 BPS, good toneAt the target

bad, warn and good request semantic error, warning and success colors. The client theme supplies the actual colors. A metric is the large reading; use kind = "value" for a compact label/value row.

These are display thresholds. Changing them does not change the native safety thresholds. A critical health check can terminate farming before the full BPS window is ready, so a stopped run may never display the ready-zero example.

Change one thing at a time

ChangeEdit
Rename the metriclabel = "Blocks per second"
Show a smaller readingkind = "value"
Use one colorSet tone = "neutral" and remove the tone calculation
Hide the running clockOmit uptime from status
Hide the status lineOmit status
Remove all presentationSet presentation = false in the session options

The sample omits profit entirely. It does not require the profit capability. Native farming health still runs when the panel is hidden or disabled.

Add a second reading

A metric or value row accepts a secondary table. For example, add this field to the metric row above to show the section beside BPS:

secondary = {
label = "Section",
value = snapshot.section_name or "–",
tone = "neutral",
},

Before startup observations are ready, section_name may be absent. Keep labels short. Long text is clipped with an ellipsis; it does not wrap into another row.

Add profit or skill progress

Those readings do not live in the farming snapshot. Use the existing profit and skill APIs, or retain the default renderer supplied by the farming library. The default renderer already includes Bazaar/NPC estimates, comparable history, collected quantities, the next level number and Farming 60 ETA.

Choose the correct data source before adding a reading. Show a HUD covers meters, charts, references and panel limits.