Configuration
Every key in tUnit's config.lua with its type, default and legal range: rendering, the DUI atlas, fonts, new-element defaults, seeded layouts and driver-set sources.
You edit config.lua and config/sv_sources.lua, which is where an element's value comes from — see the API reference. Both are escrow_ignored and survive an update.
config.lua is validated at startup, naming the key, the file and the fix. A bad setting never stops the resource; the one exception is atlas geometry.
Access is not configurable: /tunit requires being the driver, /tunitedit the tlib.admin ACE.
Rendering
Config.render = { drawDistance = 50.0, maxPropsOnScreen = 96 }| Key | Type | Default | Meaning |
|---|---|---|---|
drawDistance | metres | 50.0 | Past this, the plane is released entirely |
maxPropsOnScreen | count | 96 | Planes on screen at once, all vehicles |
Raising drawDistance spends maxPropsOnScreen faster; lowering it is the usual fix for hitting the ceiling. At the ceiling the nearest elements are kept and the console names the counts once — read that line first: it says whether the cause is a crowd of cars or one wide per-character element.
There is no brightness or fade control.
The atlas
Every element on screen draws from one texture divided into cells, keyed by content — two cars showing 114 in the same font share one cell.
Config.atlas = {
width = 1024, height = 1024,
cols = 4, rows = 8,
cellWidth = 256, cellHeight = 128,
edgeSoftness = 0.6,
}cols × cellWidth must equal width, and rows × cellHeight must equal height. This is the one hard rule — get it wrong and every string draws wrong, with nothing on screen to explain it. The config check corrects the geometry for the session; fix the file anyway.
4 × 8 cells gives 32 distinct strings at once. For more, add rows or columns and grow width/height to match.
edgeSoftness is pixels of blur on the glyph, clamped to 0 … 3. 0 is the first thing to crawl at distance; past about 1.5 a thin face looks out of focus. Deleting the key gets you 0.6.
Fonts
Config.fonts = {
condensed = { family = 'tUnitCondensed', weight = 900, label = 'Condensed Black' },
block = { family = 'tUnitBlock', weight = 400, label = 'Block' },
stencil = { family = 'tUnitStencil', weight = 800, label = 'Stencil' },
}
Config.defaultFont = 'condensed'family is the CSS family web/atlas.html defines with @font-face; label is the dropdown's text and names the style, not the typeface, so replacing block.woff2 needs no edit here. weight is documentation only — web/atlas.html's FAMILIES map is what the page applies, and a mismatch is reported nowhere.
Config.defaultFont is what an element naming a font this server lacks falls back to. It must be a key in Config.fonts. Adding a face is four steps under Adding your own typeface.
Defaults for a new element
Config.newElement = {
x = 0.0, y = -0.75, z = 0.80,
rx = 0.0, ry = 0.0, rz = 0.0,
w = 0.30, h = 0.15, color = '#101010',
}Keep it in front of the vehicle and above the ground: at 0,0,0 a new element lands inside the engine block, which reads as "nothing happened".
Seeded layouts
Keyed by spawn name.
Config.layouts = {
valor2rb = {
{ id = 'left', src = 'unit', x = -1.02, y = -0.30, z = 0.72,
rx = 0.0, ry = 0.0, rz = 90.0, w = 0.42, h = 0.21,
font = 'condensed', color = '#101010' },
-- 'right' is the mirror: x = 1.02, rz = -90.0
},
}Every field is documented under the element record. Delete the seeded entries if you do not have valor2rb and valor5rb.
Precedence
data.json wins. Once a model has been saved from the editor, editing it in Config.layouts does nothing, and tunit_diag says so per model. To get the seed back, delete that model's entry from data.json; otherwise edit in game.
Ceilings on a layout
In shared/sh_elements.lua, not configurable.
| Limit | Value | Applies to |
|---|---|---|
MAX_TEXT | 24 characters | One element's string |
MAX_PER_MODEL | 16 elements | One vehicle model |
MAX_SIZE_M / MIN_SIZE_M | 6.0 m / 0.01 m | An element's width or height |
MAX_OFFSET_M | 20.0 m | An offset from the vehicle |
A longer list is truncated and the config check says how many were dropped. Offsets and sizes are clamped; rotations wrap modulo 360, so 370 gives 10°.
Driver-set values
Config.userSources = { unit = { label = 'Unit number', default = '000' } }
Config.defaultSource = 'unit'Sources a driver may set from /tunit, and the label the menu shows. A source registered in config/sv_sources.lua is computed by your code and cannot be typed over; naming the same source in both places is a config error.
default is a real value, not a prefilled field: an element shows it until a driver types their own. An empty string is legal and means "blank until somebody sets it".
Config.defaultSource is what a new element points at. It must name a Config.userSources key or a registered source; the config check refuses anything else.
A typed value survives a reconnect. It does not survive a restart.
tUnit
Still stuck? Support can answer it directly.
Was this page helpful?
TIMMYG Studios