Skip to main content

Recipes

Recipes define what can be crafted, what ingredients are needed, and what the player receives.

Recipe Structure

Config.Recipes = {
['lockpick_advanced'] = {
label = 'Advanced Lockpick',
description = 'A more durable lockpick',
duration = 120, -- 2 minutes in seconds
ingredients = {
{ name = 'lockpick', count = 2, label = 'Lockpick' },
{ name = 'steel', count = 3, label = 'Steel' },
},
outputs = {
{ name = 'advancedlockpick', count = 1, label = 'Advanced Lockpick' },
},
successRate = 1.0, -- 100% success
},
}

Recipe Options

OptionTypeRequiredDescription
labelstringDisplay name in UI
descriptionstringShown in recipe details
durationnumberCraft time in seconds
ingredientstableRequired items
outputstableItems given on success
successRatenumber0.0-1.0, default 1.0
craftModelstringCustom spinning prop
craftParticletableCustom particle effect
jobstableJob restriction
stationstableLimit to specific stations

Duration Examples

DurationTime
3030 seconds
601 minute
3005 minutes
60010 minutes
180030 minutes
36001 hour

Success Rate

The successRate determines the chance of success:

successRate = 1.0,   -- 100% success
successRate = 0.85, -- 85% success
successRate = 0.5, -- 50% success (coin flip)

When a craft fails:

  • Ingredients are consumed (not returned)
  • Player gets a notification
  • The onCraftFail hook is called

Custom Craft Model

Override the spinning prop for specific recipes:

['weapon_pistol'] = {
label = 'Pistol',
duration = 600,
craftModel = 'w_pi_pistol', -- Shows a pistol spinning
ingredients = {
{ name = 'steel', count = 20, label = 'Steel' },
},
outputs = {
{ name = 'WEAPON_PISTOL', count = 1, label = 'Pistol' },
},
},

Custom Particles

Add special effects during crafting:

['meth'] = {
label = 'Methamphetamine',
duration = 300,
craftParticle = {
asset = 'core',
name = 'ent_sht_steam',
scale = 1.5,
offset = { x = 0, y = 0, z = 0.5 },
},
ingredients = { ... },
outputs = { ... },
},

Job-Restricted Recipes

Limit a recipe to specific jobs:

['police_radio'] = {
label = 'Police Radio',
duration = 60,
jobs = { 'police', 'sheriff' },
ingredients = {
{ name = 'radio', count = 1, label = 'Radio' },
},
outputs = {
{ name = 'police_radio', count = 1, label = 'Police Radio' },
},
},

Station-Specific Recipes

Limit a recipe to specific station types:

['gourmet_burger'] = {
label = 'Gourmet Burger',
duration = 120,
stations = { 'cooking' }, -- Only at cooking stations
ingredients = {
{ name = 'meat', count = 1, label = 'Meat' },
{ name = 'bread', count = 2, label = 'Bread' },
},
outputs = {
{ name = 'burger', count = 1, label = 'Gourmet Burger' },
},
},

Multiple Outputs

Recipes can produce multiple items:

['ammo_box'] = {
label = 'Ammunition Box',
duration = 180,
ingredients = {
{ name = 'steel', count = 10, label = 'Steel' },
{ name = 'copper', count = 5, label = 'Copper' },
},
outputs = {
{ name = 'ammo_pistol', count = 30, label = 'Pistol Ammo' },
{ name = 'ammo_rifle', count = 20, label = 'Rifle Ammo' },
},
},

Full Example

['weapon_smg'] = {
label = 'SMG',
description = 'A compact submachine gun',
duration = 1800, -- 30 minutes
craftModel = 'w_sb_smg',
craftParticle = {
asset = 'core',
name = 'ent_dst_gen_spark_spawn',
scale = 1.0,
offset = { x = 0, y = 0, z = 0.3 },
},
ingredients = {
{ name = 'steel', count = 30, label = 'Steel' },
{ name = 'plastic', count = 15, label = 'Plastic' },
{ name = 'copper', count = 10, label = 'Copper' },
{ name = 'gun_parts', count = 1, label = 'Gun Parts' },
},
outputs = {
{ name = 'WEAPON_SMG', count = 1, label = 'SMG' },
},
successRate = 0.75,
jobs = { 'gundealer' },
},