Skip to content

Latest commit

 

History

History
129 lines (100 loc) · 5.68 KB

File metadata and controls

129 lines (100 loc) · 5.68 KB

Configuration

Configuration is split across two kinds of file, both inside shared/ and both loaded by the shared/*.lua glob in fxmanifest.lua:

  • shared/config.lua — the two global switches.
  • One file per processing spot — template.lua, cut_chicken.lua, plucked_chicken.lua, plus anything you add.

The glob is expanded alphabetically, which is why config.lua is guaranteed to run before any spot file that writes into Config. All of these are shared scripts, so the same tables exist on both the client and the server.

shared/config.lua

Key Type Default Description
Config.ShowPolyDebug boolean false Handed to qb-target as debugPoly when the zones are created, drawing an outline around every processing zone. Read once at resource start, so a restart is needed for a change to show.
Config.ProcessingSpots table {} Registry of every spot, keyed by the spotName of the file that registered it. Not meant to be filled in by hand.

The file also creates a local QBCore handle at the top. Nothing in config.lua uses it.

A spot file

Each spot file declares two locals and then copies the second into the registry:

local spotName = "chicken_breast" -- Needs to be unique
local options = { ... }

CreateThread(function()
    Config.ProcessingSpots[spotName] = options
end)

spotName is the registry key and also the prefix of the qb-target zone names (<spotName>_1, <spotName>_2, …). It has to be unique across all spot files; it does not have to match the file name or any item name.

Top level of options

Key Type Required Description
icon string yes Font Awesome class shown on the qb-target option and as the menu header icon, e.g. "fa fa-hand"
label string yes Text on the qb-target option and the menu header
blip table no Map blip. Omit the whole table and the spot gets no blip.
spots array of tables yes The interaction zones. At least one.
items table yes The recipes offered at this spot

options.blip

Only read if the table is present. Every field below is then used unconditionally, so leaving one out will error.

Key Type Example Description
coords vector3 vector3(-103.33, 6209.11, 31.03) Where the blip sits. Independent of the zone coordinates.
shortRange boolean true true hides the blip until the player is nearby
sprite number 504 Blip icon ID
color number 37 Blip colour ID
scale number 0.6 Blip size
label string "Hühner schneiden" Name shown on the map

The blip is always created with display mode 6 (main map and minimap). Blips are created once at resource start and are never removed again.

options.spots[n]

An array — [1], [2], and so on. Each entry becomes one qb-target box zone, and every zone offers the same recipe menu.

Key Type Example Description
coords vector3 vector3(207.62, -1010.84, 29.59) Centre of the zone
length number 1.0 Zone length
width number 1.0 Zone width
heading number 340 Zone rotation in degrees
minZ number 26.99 Bottom of the zone
maxZ number 30.99 Top of the zone
distance number 2.0 How far away the qb-target option becomes selectable

options.items[<produced item>]

The key of each entry is the item name the player receives. Both that key and every key under required must exist in qb-core/shared/items.lua.

Key Type Required Description
processingDesc string yes Label shown on the progressbar
required table no { ["item"] = amount }, the materials consumed per batch. Omit it entirely for a recipe that costs nothing.
amount number yes How many of the produced item one batch yields
animation.dict string yes Animation dictionary streamed in before the progressbar
animation.anim string yes Animation clip inside that dictionary
animation.flags number yes Animation flags, e.g. 8
duration number yes Progressbar length in milliseconds
icon string yes Font Awesome class for this recipe's menu entry
job array of strings no Job names allowed to use this recipe
gang array of strings no Gang names allowed to use this recipe

Notes that are not obvious from the field names:

  • job and gang are OR'd. Matching any one entry in either list is enough; a player never has to hold a listed job and a listed gang. Omitting both leaves the recipe open to everyone. The check runs when the recipe is picked, not when the menu is built, so restricted recipes are still listed to players who cannot use them.
  • One action can process more than one batch. The server counts how many full batches the player has materials for and processes all of them at once, multiplying both the materials removed and the amount handed back. duration does not change with that count.
  • required amounts are per batch, and the scarcest material decides the batch count.
  • Weight is checked, slots are not. The server compares carried weight after the swap against ps-inventory's global maximum. If the swap fits by weight but not by free slots, the materials are refunded and the player is told nothing.

Locale

The language is chosen by the standard qb-core convar, not by anything in this resource:

setr qb_locale "de"

Anything other than de leaves the English strings in place. See localisation.md.