hud

The game's own HUD: hide, move or resize its parts, open and close the hunt's menu.

The game draws its HUD itself: the MENU tab, the health bar, the ammo count, the compass and the rest. hud hides, moves and resizes those parts, so a mod can make them bigger, put them elsewhere, replace them with its own drawing (draw.*) or clear the screen. Hidden parts stay hidden until a mod shows them again, or the scripts reload (F9).

Element What it is Move / resize
menu the MENU tab at the top, and the click on it; the menu still opens with Esc or hud.openMenu no
health the health bar (shown while hurt) yes
ammo the ammo count and "out of ammo" yes
credits the credits earned in this hunt yes
compass the compass yes
trophy the trophy info window (after a kill, in the trophy room) yes
survive Survive mode's time, score and wave yes
evacuation the evacuation / relocation countdown yes
keyhints the key hints (resupply, trophy room keys) yes
binoculars the binoculars' sight and their target's name, weight and distance no

Offsets are in the same units as draw (pixels of the draw event, x to the right, y down); sizes are factors of the game's own size (1 = normal, 0.25 to 4). Esc reaches mods first, as the back event, which a mod may cancel.

Functions

# hud.hide(name, ...)

Hides parts of the game's HUD.

ParameterType
namestringan element, or "all"
...stringmore elements
-- no MENU tab: Esc opens the menu
hud.hide("menu")
-- a clean screen for a cinematic
hud.hide("all")

# hud.show(name, ...)

Shows hidden parts again.

ParameterType
namestringan element, or "all"
...stringmore elements

# hud.shown(name) → boolean

Whether a part is shown.

ParameterType
namestringan element
Returns
boolean

# hud.offset(name, dx?, dy?) → number, number

Moves a part of the HUD by dx, dy from its own place (0, 0 puts it back); without dx, dy it only returns the offset.

ParameterType
namestringa movable element
dx optionalnumberto the right
dy optionalnumberdown
Returns
numberdx
numberdy
-- the compass a bit higher, the health bar to the bottom
hud.offset("compass", 0, -40)
local w, h = draw.screen()
hud.offset("health", 0, h - 80)

# hud.scale(name, factor?) → number

Makes a part of the HUD bigger or smaller; without a factor it only returns it. The compass grows away from its corner, texts and bars around their own place.

ParameterType
namestringa movable element
factor optionalnumberits size: 1 = normal (0.25 to 4)
Returns
numberthe factor
-- a compass twice as big, a bigger health bar
hud.scale("compass", 2)
hud.scale("health", 1.5)

# hud.elements() → table

Every element, for menus that list them.

Returns
table{{name, description, movable, shown, scale}, ...}

# hud.reset()

Shows every part, normal size, in its own place.

# hud.openMenu() → boolean

hunt only

Opens the hunt's menu (ESCAPE / RESTART / OPTIONS), like Esc. Not while the hunter is dead or being evacuated.

Returns
booleanwhether the menu is open now

# hud.closeMenu() → boolean

Closes the hunt's menu.

Returns
booleanwhether it was open

# hud.menuOpen() → boolean

Whether the hunt's menu is open.

Returns
boolean