Skip to content

Document types ​

A document type (TypeDef) describes how a card looks, which data it holds, and the rules for issuing and policing it. The 14 built-in types are in shared/documents.lua. Admins override them (same key) or add new ones in the designer; those are stored in ident_types and win over the file. The same shape is used in Lua, in the database (JSON) and in the web UI.

All built-in documents, front and back

Built-in types ​

Key / item Label Validity Fee Desk Clerks (job · min. grade) Requires Back
id_card Personalausweis 365 d 150 cityhall city 0 – address + MRZ
driver_license Führerschein unlimited 500 cityhall drivingschool 0, police 3 id_card classes, points (max 8)
weapon_license Waffenschein 180 d 2500 ammunation ammunation 0, police 3 id_card, no warrant, age 21 weapon registry (3 slots)
taxi_license P-Schein 90 d 300 – taxi 3 id_card, driver_license –
lawyer_license Anwaltslizenz 365 d 1000 – doj 2 id_card –
btm_license BTM-Schein 90 d 200 – ambulance 3 id_card –
service_id Dienstausweis unlimited 0 – police / ambulance / sheriff 4 – fields (rank)
firstaid_license Erst-Helfer-Schein 365 d 100 – ambulance 1 – –
hunting_license Jagdschein 365 d 350 cityhall ranger 1 id_card, age 18, exam hunting –
pilot_license Pilotenlizenz 365 d 5000 cityhall flightschool 1 id_card, age 18 –
boat_license Bootsführerschein unlimited 800 cityhall – id_card, exam boat –
business_license Gewerbeschein 365 d 1200 cityhall city 1 id_card – (up to 3 active)
press_pass Presseausweis 180 d 0 – weazel 2 id_card –
medical_license Approbation unlimited 0 – ambulance 5 id_card –

Every type has the five classic front fields: Vor- & Nachname, Größe, Geburtsdatum, Ausstelldatum and Geschlecht. Some add their own: nationality and address (id_card), classes and restrictions (driver_license), category and purpose (weapon_license), agency and rank (service_id), class (pilot_license), trade (business_license), specialty (medical_license).

np_fishing checks a further type, fishing_license (Angelschein: 1 year, fee 100, desk cityhall, clerks ranger 0, requires id_card and age 16, renewable online), which np_identification adds for it. See Exports → Used by np_fishing.

Two exams ship with the types: hunting (3 questions) and boat (2 questions), both with an 80 % pass mark.

TypeDef ​

lua
Documents.id_card = {
  label = 'Personalausweis',   -- UI name
  item = 'id_card',            -- inventory item (one per type)
  design = { … },              -- card look
  fields = { … },              -- data on the card
  back = { template = 'address' },
  rules = { … },               -- issuing, renewal, police
}

The key ([a-z0-9_], 2–48 characters) is the table key in Documents. The server adds version (the published version; config types are version 0) and source ('config' or 'db').

Design ​

lua
design = {
  title = 'Personalausweis', state = 'San Andreas',
  colors = { '#f286f2', '#d64fd6' }, angle = 120,      -- gradient
  star = true, hologram = true,
  icon = 'fa-id-card', tint = 'pink',                  -- icon and Nimbus tile tint in lists (picker, phone)
  watermark = { kind = 'seal' },                       -- 'seal' | 'icon' (+ icon) | 'image' (+ url) | 'none'
  corner = 'fa-car-side',                              -- optional corner icon
  seal = 'city',                                       -- small seal bottom right: 'city' | 'doj' | 'none'
  logos = {                                            -- up to 3
    { kind = 'builtin', id = 'ammunation' },           -- ammunation | dashound | downtowncab | weazel | gruppe6
    { kind = 'image', url = 'https://r2.fivemanage.com/…' },
    { kind = 'text', text = 'GRUPPE6', icon = 'fa-shield-halved', color = '#3a2a6a' },
  },
  layout = nil,                                        -- freeform layout from the designer, nil = default template
}

The fixed card chrome is the gradient, the laminate sheen, the header (red star, title, state), the double rule, the issue-date line, the watermark, the small seal and the logos. Everything else (photo, fields, signature, serial, expiry, corner icon, hologram) is an element of the layout, so the designer can move it.

layout = { front = Element[], back = Element[] } holds a freeform layout on a 680 × 400 canvas. Without it the default template places every field of a side once. Element kinds: field, text, photo, signature, image, qr, barcode, table, hologram, serial, expiry, icon. Text elements accept the placeholders {fieldId}, {serial}, {expires}, {issued}, {holder}, {mrz} and {mrz1}…{mrz3} (a TD1-style machine-readable zone).

Fields ​

lua
{ id = 'classes', label = 'Klassen', source = 'input.multi', type = 'list', required = true, side = 'back',
  options = { 'AM', 'A', 'B', 'BE', 'C', 'CE', 'D' } }
Key Description
id [a-z0-9_], 1–32 characters, unique per type
label Label on the card and in the forms
source Where the value comes from (table below)
type text, number, date, select or list
required Must have a value when issued
side front or back
align left or center (default template)
options Choices for input.select / input.multi
text The fixed text for source = 'static'
hideEmpty Hide the field when it has no value

Sources are resolved by the server when the document is issued. Anything else is rejected.

Group Sources
Character character.name, character.firstname, character.lastname, character.dob, character.sex, character.height, character.nationality
Job job.label, job.gradeLabel, job.name
Automatic auto.issued, auto.expires, auto.serial, issuer.name, issuer.job
Static static (uses text)
Input input.text, input.number, input.date, input.select, input.multi

A character.* field without a value becomes an input at the desk or the clerk panel (height on qb, everything but the name on standalone). Dates are stored as ISO and formatted with Config.DateFormat. Sex is stored as m, f or x and shown localised.

Back templates ​

Used when the type has no freeform layout:

Template Back side
none Only expiry, seal and logos
address Back fields plus a machine-readable zone
classes The first back list field as a classes table (grouped by first letter), plus point boxes when pointsMax is set
weapons The weapon registry with rules.weaponSlots rows
fields Every back field in a grid

Rules ​

lua
rules = {
  validityDays = 365,          -- 0 = unlimited
  price = 150,
  account = nil,               -- society account that receives the fee (nil = the money is just removed)
  renewOnline = true,          -- renew from the phone app for `price`
  maxActive = 1,               -- active (valid / suspended, not expired) documents per character, 0 = no limit
  pointsMax = 8,               -- with police.points: reaching it suspends for Config.Points.suspendDays
  weaponSlots = 3,             -- weapon registry entries (back template 'weapons')
  serial = 'LS #######',       -- overrides Config.SerialPattern
  issuers = { { job = 'police', grade = 3 } },     -- player clerks (admins always may)
  desks = { 'cityhall' },                          -- desk ids that offer it (a desk's own `types` count too)
  requires = { documents = { 'id_card' }, noWarrant = true, minAge = 21, exam = 'hunting' },
  police = { check = true, suspend = true, seize = true, minGrade = 0, points = false },
}
Rule Effect
requires.documents Valid documents of these types
requires.noWarrant No open warrant (MDT bridge or your warrant provider)
requires.minAge Age from character.dob
requires.exam Exam key. Answered at the desk
police.check Police may check this type
police.suspend Police may suspend and revoke it
police.seize Police may seize the card
police.minGrade Minimum police grade for these actions
police.points Points system (needs pointsMax)

Exams ​

lua
Exams.hunting = {
  label = 'Jagdschein-Prüfung', passPercent = 80,
  questions = {
    { q = 'Darfst du Tiere in der Stadt jagen?', a = { 'Ja', 'Nein' }, correct = 2 },
  },
}

correct is the 1-based index into a. It is stripped before an exam is sent to players. Exams saved in the designer live in ident_exams and win over the file.

Validation ​

Definitions from the designer and from imports are validated on the server: keys and ids by pattern, colours as #rrggbb, icons as fa-…, image URLs https:// from Config.ImageHosts, at most 40 fields, 80 elements per side and 3 logos, numbers clamped to the canvas, texts up to 64 characters (text elements 120), sources from the whitelist, rules clamped (fee 0 to 10 000 000, days 0 to 3650). Errors carry the path, for example invalid_definition:design.logos.1.url.

Versions ​

Publishing a type in the designer creates a new version (1, 2, 3, …) and keeps every old definition in ident_type_versions. Every document stores the version it was issued with. What happens to existing cards depends on the migration mode chosen when publishing (see Designer → Publishing): they take the new design, keep the old one, or expire after a grace period so their holders get them reissued.

Version 0 is the definition from shared/documents.lua. Rolling back to 0 removes the database override.