Skip to content

Templates & catalog ​

Two kinds of definitions drive the workshop, and both are server-owned:

  • Vehicle templates say what can be done with a model: canvas sizes, application modes, UV projections, part slots, locked layers.
  • Attachment definitions (parts) say which prop can be fitted, where, within which limits, for whom and at what price.

A client only ever sends a template or definition id plus a transform; it never supplies a model name for a prop or any behaviour.

Where definitions come from ​

Source (sourceKind) Defined in Status at start
fixture shared/catalog.lua (VehicleManufacturingCatalog.Templates / .Attachments) As written (the shipped ones are approved). Loaded only with enableFixtureCatalog = true
registered Another resource, through the registerTemplate / registerAttachment exports Always pending
onboarded The admin onboarding wizard (Administration) Always pending

Registered and onboarded definitions are stored in the server state and survive restarts. A stored definition with the same id as a fixture replaces it. Only approved definitions are used; approve them in the console's catalog tab or with setTemplateStatus / setAttachmentStatus.

The shipped fixtures (one police cruiser template, five parts) exist to exercise the server contract. They are development fixtures, not tested production content.

Vehicle templates ​

lua
VehicleManufacturingCatalog.Templates.my_police_v1 = {
  templateId = 'my_police_v1',
  templateVersion = 1,
  modelName = 'police',
  modelHash = 2046537925,           -- optional; otherwise GetHashKey(modelName)
  displayName = 'Police Cruiser',
  sourceKind = 'fixture',
  status = 'approved',
  vehicleClass = 18,                -- trusted fact: emergency
  liveryCount = 5,                  -- trusted fact: native livery slots
  silhouette = 'sedan',
  supportedCanvasSizes = { 512, 1024 },
  supportedLiveryModes = { native_livery = true, draft_only = true },
  paintChannels = { 'primary', 'secondary' },
  textureTargets = {},
  attachmentAnchors = {
    roof = { slot = 'roof', label = 'Roof', anchorMode = 'bone', boneName = 'chassis',
             position = { x = 0.0, y = -0.15, z = 0.85 }, rotation = { x = 0.0, y = 0.0, z = 0.0 },
             accepts = { 'lightbar', 'light', 'comms' } },
    mirror_left = { slot = 'mirror_left', label = 'Left mirror', anchorMode = 'bone', boneName = 'chassis',
                    position = { x = -0.95, y = 0.75, z = 0.45 }, rotation = { x = 0.0, y = 0.0, z = 0.0 },
                    mirrorOf = 'mirror_right', accepts = { 'light' } },
    -- …
  },
  projections = {
    left  = { x = 0.0, y = 0.0,  w = 1.0, h = 0.34 },
    right = { x = 0.0, y = 0.34, w = 1.0, h = 0.34, flipX = true },
    top   = { x = 0.0, y = 0.68, w = 0.6, h = 0.32 },
    front = { x = 0.6, y = 0.68, w = 0.2, h = 0.32 },
    rear  = { x = 0.8, y = 0.68, w = 0.2, h = 0.32 },
  },
  capabilities = { editor = true, browserPreview = true, nativeLivery = true, runtimeTexture = false, attachments = true },
}
Field Description
templateId Unique id ([%w_-]+)
templateVersion Version number shown in the catalog
modelName, modelHash The model it applies to. With modelHash set, the hash is compared; else GetHashKey(modelName)
modelResource, artifactVersion Informational
displayName Shown in the console
sourceKind, status See above
vehicleClass Trusted GTA vehicle class (0..22). The server can't read it from the entity; without it, class-restricted parts are denied
liveryCount Trusted number of native livery slots. Native livery indices are range-checked against it
silhouette Editor guide drawing: sedan, suv, van, truck, bike, coupe
supportedCanvasSizes Allowed canvas sizes (within minCanvasSize … maxCanvasSize)
supportedLiveryModes { native_livery?, runtime_texture?, runtime_slot?, prebuilt?, draft_only? }
paintChannels Informational (primary, secondary)
textureTargets For runtime_texture: { targetId, originalDictionary, originalName, replacementName?, width?, height? }. Aliases: dictionary / txd, texture / name. Must be tested per model
liverySlots For runtime_slot: the prepared slot pool { system, dictionary, hiDictionary?, baseIndex, width?, height?, slots = { { index, texture } } }. See Preparing a model
attachmentAnchors Part slots, keyed by slot id (see below)
projections UV regions per editor view. Missing views use the default layout
lockedLayers Livery layers forced into every draft (templateLocked; can't be moved or removed)
capabilities editor, browserPreview, nativeLivery, runtimeTexture, runtimeSlot, attachments, prebuilt
prebuiltArtifact For prebuilt: see Prebuilt artifacts

A vehicle uses the first approved template (by id) that matches its model.

Baked liveries are not a template field: they are stored per template and build in the server state (see Baking live designs).

Attachment anchors (slots) ​

Field Description
slot Slot id (defaults to the key), e.g. roof, push_bar, mirror_left
label Shown in the equipment screen
anchorMode bone or offset
boneName Bone the prop attaches to (chassis, bumper_f, boot, door_dside_f, …). The final build attaches each part to its slot's bone
position, rotation Slot position relative to the bone
mirrorOf The paired slot for M (mirror)
accepts Accepted part categories. Empty = any

Application modes ​

Mode Requires Effect
native_livery capabilities.nativeLivery Sets one of the model's built-in livery slots (nativeLiveryIndex)
runtime_texture allowRuntimeTexturePreview, capabilities.runtimeTexture, a textureTargets entry, np_manufacturing.runtime_livery Replaces the texture target with the rendered design. Global per target, see Configuration
runtime_slot runtimeSlots.enabled, capabilities.runtimeSlot, a valid liverySlots pool, np_manufacturing.runtime_livery Gives each car a slot of the pool and renders its own design on it. See Live liveries
prebuilt allowPrebuiltApplication, capabilities.prebuilt, prebuiltArtifact, the adapter resource started Asks another resource to apply a shipped texture
draft_only at least one part Stores the design, fits the parts, doesn't paint the car

Prebuilt artifacts ​

lua
prebuiltArtifact = {
  resourceName = 'my_liveries',          -- or prebuiltAdapter.resourceName
  artifactId = 'lspd_2027',
  version = '1',
  applyExport = 'applyVehicleArtifact',  -- or prebuiltAdapter.applyExport
  clearExport = 'clearVehicleArtifact',  -- or prebuiltAdapter.clearExport
},

When a prebuilt build is applied, every client calls exports[resourceName][applyExport](networkId, artifact); reverting calls clearExport with the same arguments. Returning false from the apply export reports a failure.

Attachment definitions ​

lua
VehicleManufacturingCatalog.Attachments.my_lightbar_v1 = {
  definitionId = 'my_lightbar_v1',
  displayName = 'Roof lightbar',
  modelName = 'prop_air_lights_02a',
  sourceKind = 'fixture',
  status = 'approved',
  category = 'lightbar',
  icon = 'lightbulb',
  defaultSlot = 'roof',
  defaultTransform = { position = { x = 0.0, y = -0.15, z = 0.85 }, rotation = { x = 0.0, y = 0.0, z = 0.0 }, scale = 1.0 },
  limits = {
    position = { x = { min = -2.0, max = 2.0 }, y = { min = -4.0, max = 4.0 }, z = { min = -1.0, max = 3.0 } },
    rotation = { x = { min = -180.0, max = 180.0 }, y = { min = -180.0, max = 180.0 }, z = { min = -180.0, max = 180.0 } },
    scale = { min = 1.0, max = 1.0 },
  },
  allowedVehicleClasses = {},           -- e.g. { 18 } for emergency only
  allowedModelKeys = {},                -- e.g. { 'police', 'police2' }
  anchorMode = 'bone',
  defaultAnchorBone = 'chassis',
  collisionPolicy = 'disabled',
  lightingProfile = 'visual_only',
  emergencyEquipment = true,
  requiredPermission = nil,             -- e.g. 'np_manufacturing.swat'
  price = 2400,
  weightKg = 14,
  fitSeconds = 45,
  materials = { { item = 'wiring_kit', label = 'Wiring kit', count = 1 } },
}
Field Description
definitionId Unique id ([%w_-]+)
displayName, icon Shown in the catalog (Font Awesome solid icon name without fa-)
modelName Prop model ([%w_-]+). Never sent by the client
category lightbar, bar, light, comms, interior, body or your own. Matched against a slot's accepts; also the catalog filter
defaultSlot Slot the part snaps to
defaultTransform Position, rotation, scale used when the player doesn't move it
limits Allowed position / rotation range and scale range. Scale other than 1.0 is rejected
allowedVehicleClasses, allowedModelKeys Empty = any. Classes come from the template's vehicleClass
anchorMode, defaultAnchorBone Used when a template has no slots
collisionPolicy, lightingProfile Props are visual only; collision is disabled
emergencyEquipment Needs np_manufacturing.emergency
requiredPermission An extra np_admin permission node needed to fit it (registered in np_admin automatically); shown locked otherwise
price, weightKg, fitSeconds Bill, weight budget, labour time and job step duration
materials { item, label, count }[] consumed in the job's materials step

Fixture props

The fixture parts use vanilla props. Their scale and default offsets on the police cruiser have not been verified in game; tune defaultTransform and the template slots on your server.

Registering from another resource ​

Server side, from a resource listed in trustedServerResources:

lua
-- server.lua of my_fleet_content (and in np_manufacturing: trustedServerResources = { ['my_fleet_content'] = true })
-- Run once from the server console: register_fleet_content
RegisterCommand('register_fleet_content', function(source)
  if source ~= 0 then return end

  local ok = exports.np_manufacturing:registerTemplate({
    templateId = 'police4_v1',
    templateVersion = 1,
    modelName = 'police4',
    displayName = 'Unmarked Cruiser',
    vehicleClass = 18,
    liveryCount = 0,
    silhouette = 'sedan',
    supportedCanvasSizes = { 1024 },
    supportedLiveryModes = { draft_only = true },
    paintChannels = { 'primary', 'secondary' },
    textureTargets = {},
    attachmentAnchors = { --[[ … ]] },
    capabilities = { editor = true, attachments = true },
  })

  exports.np_manufacturing:registerAttachment({
    definitionId = 'grille_strobes_v1',
    displayName = 'LED grille strobes',
    modelName = 'my_grille_strobes',
    category = 'light',
    defaultSlot = 'push_bar',
    defaultTransform = { position = { x = 0.0, y = 2.3, z = 0.1 }, rotation = { x = 0.0, y = 0.0, z = 0.0 }, scale = 1.0 },
    limits = { --[[ as above ]] },
    emergencyEquipment = true,
    price = 950, weightKg = 1, fitSeconds = 20,
  })
end, true)

Both exports return false for untrusted callers or invalid input. registerTemplate requires templateId, modelName, capabilities and supportedLiveryModes, plus attachmentAnchors when capabilities.attachments and prebuiltArtifact when capabilities.prebuilt. It also refuses a template with an invalid liverySlots pool. shared/catalog.lua contains a commented-out example of a per-car template. registerAttachment requires definitionId, modelName, defaultTransform and limits; price, weightKg and fitSeconds default to 0, 0 and 30.

Registered definitions always start pending, and registering the same id again replaces the stored definition and resets it to pending. Register once (or when the definition changes) rather than on every start. Approve them in the console, or from the trusted resource:

lua
exports.np_manufacturing:setTemplateStatus('police4_v1', 'approved')
exports.np_manufacturing:setAttachmentStatus('grille_strobes_v1', 'approved')

See Exports for all server exports.