Skip to content

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, driver-set sources and automatic unit numbers.

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

lua
Config.render = { drawDistance = 50.0, maxPropsOnScreen = 96 }
KeyTypeDefaultMeaning
drawDistancemetres50.0Past this, the plane is released entirely
maxPropsOnScreencount96Planes 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.

lua
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

lua
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

lua
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.

lua
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.

LimitValueApplies to
MAX_TEXT24 charactersOne element's string
MAX_PER_MODEL16 elementsOne vehicle model
MAX_SIZE_M / MIN_SIZE_M6.0 m / 0.01 mAn element's width or height
MAX_OFFSET_M20.0 mAn 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

lua
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.

Automatic unit numbers

lua
Config.autoAssign = { enabled = false, source = 'unit', format = '###' }

Off. Left off, tUnit behaves exactly as it always has: a vehicle shows a number once somebody sets one, and nothing before that.

Turned on, every vehicle is given a random number the moment it spawns and is never without one again. A driver who sets their own from /tunit replaces it for as long as the car is theirs; when it stops being theirs the car goes back to the number it spawned with rather than going blank.

KeyTypeDefaultMeaning
enabledbooleanfalseNothing below it is read, or checked, while this is false
sourcestring'unit'Which Config.userSources key gets the value
formatstring'###'# is a digit, A a letter, anything else itself

So '###' is 000–999 and '#A-##' is 3C-07. A format with no # or A gives every car the same number and is reported; one carrying characters tUnit filters out cannot produce a number at all, so it is reported and corrected to ### for the session.

The number is rolled on the server and written to the same state bag everything else uses, so every player sees the same number on the same car.

When a car stops being yours

Exactly the three ways a mark has always ended. Getting out is not one of them — a parked car still wears its unit's number.

  • you take a different wheel — the number follows you and the car you left reverts;
  • somebody else takes that wheel — it is re-resolved for them, so a driver who has set nothing puts the car back on its own number;
  • the vehicle is destroyed.

Restarts and re-streams

A re-stream changes nothing: the number lives in a server-side state bag on the entity, not on any client.

A restart tUnit keeps the numbers. The seeding pass adopts whatever each vehicle already carries rather than re-rolling, because renumbering every car on the server is not what an operator restarting to change a font asked for. The cost is that a number a driver had explicitly set becomes that vehicle's automatic one — the ownership tracking did not survive the restart either.

Still stuck? Support can answer it directly.

Was this page helpful?