# Guide

## Configuration Guide

***

### Configuration Files Overview

The script uses three main configuration files:

1. **`config/main.lua`** - General settings, language strings, UI config
2. **`config/workbench.lua`** - Workbench definitions (static and placeable)
3. **`config/recipes.lua`** - Crafting recipes

***

### Workbench Configuration

#### Configuration Structure

`config/workbench.lua` contains three main sections:

**1. `Config.PropSettings` - Prop Models and Offsets**

Defines visual models and camera positions for placeable workbenches:

```lua
Config.PropSettings = {
    small = {
        model = 'prop_tool_bench02_ld',
        spawnOffset = { coords = vector3(0.0, 0.0, 0.0) },
        camOffset = { coords = vector3(0.0, -0.1, 0.15), heading = 90.0 }
    },
    large = {
        model = 'gr_prop_gr_bench_04b',
        spawnOffset = { coords = vector3(0.0, 0.0, 0.0) },
        camOffset = { coords = vector3(0.0, -0.6, 0.15) }
    }
}
```

**Available prop models:**

* Small: `prop_tool_bench02_ld`
* Large: `gr_prop_gr_bench_04b` (general), `gr_prop_gr_bench_02b` (weapon)

{% hint style="info" %}
You can create new tables with other props.
{% endhint %}

**2. `Config.Workbench` - Static World Workbenches**

Pre-defined workbenches that exist in the world (not placeable by players):

```lua
Config.Workbench = {
    general = {
        blip = { enabled = false, label = 'Crafting Station', sprite = 351, color = 60, scale = 0.8 },
        label = "Crafting Tools Station",
        groups = nil,  -- nil = everyone, or { jobname = 0, gangname = 0 }
        
        objectSettings = Config.PropSettings.large,
        objectCoords = vector4(x, y, z, heading),
        
        interaction = {
            type = 'interact',
            distView = 5,
            distInteract = 2.1
        },
        
        allowBlueprints = false,
        
        recipes = {
            "lockpick", "electronickit", "trojan_usb", "thermite",
            "WEAPON_PISTOL"
        },
        
        stash = {
            storage = {
                label = 'Storage',
                slots = 30,
                weight = 150000,
                whitelist = { 'metalscrap', 'iron' }
            },
            blueprint = {
                label = 'Blueprints',
                slots = 10,
                weight = 5000
            }
        }
    }
}
```

**Key fields:**

* `blip`: Map blip configuration (set `enabled = false` to hide)
* `groups`: Job/gang restrictions (nil = public)
* `objectSettings`: Reference to `Config.PropSettings` entry
* `objectCoords`: World position (vector4 with heading)
* `interaction`: How players interact with the bench
* `allowBlueprints`: If true, any blueprint can be used
* `recipes`: List of recipe keys that can be crafted without blueprints
* `stash`: Two separate inventories (storage for materials, blueprint for blueprints)

**3. `Config.WorkbenchPlaceable` - Placeable Workbench Items**

Items that players can place inside properties:

```lua
Config.WorkbenchPlaceable = {
    lvs_crafting_table_small = {
        objectSettings = Config.PropSettings.small,
        interaction = { type = 'interact', distView = 5, distInteract = 2.1 },
        
        stash = {
            storage = {
                label = 'Storage',
                slots = 30,
                weight = 150000,
                whitelist = { 'bandage', 'burger' }
            },
            blueprint = {
                label = 'Blueprints',
                slots = 10,
                weight = 5000
            }
        },
        
        allowBlueprints = true,
        recipes = {}
    }
}
```

**Important:** The index (`lvs_crafting_table_small`) **must match** the item name in your inventory items file.

***

### Recipe Configuration

#### Recipe Structure

`config/recipes.lua` defines all craftable items:

```lua
Config.Recipes = {
    lockpick = {
        count = 1,
        duration = 60,
        ingredients = {
            metalscrap = 10,
            iron = 25
        },
        successRate = 90,
        requireBlueprint = false,
        prop = {
            model = 'hei_prop_heist_thermite_case',
            offsetZ = 0
        }
    },
    
    lvs_stock_brakes = {
        count = 1,
        duration = 60,
        ingredients = {
            metalscrap = 10
        },
        prop = {
            model = 'imp_prop_impexp_brake_caliper_01a',
            offsetZ = 0
        },
        blueprint = {
            name = 'brake_blueprint',
            degrade = 0.2
        },
        tool = {
            name = 'lvs_wrench',
            degrade = 0.05
        }
    },
    
    WEAPON_PISTOL = {
        count = 1,
        duration = 550,
        isWeapon = true,
        ingredients = {
            metalscrap = 100
        },
        prop = {
            model = 'WEAPON_PISTOL',
            offsetZ = 0
        }
    }
}
```

**Recipe Fields:**

* `count`: Number of items produced
* `duration`: Crafting time in seconds
* `ingredients`: Table of `{ item_name = quantity }`
* `successRate`: Optional success percentage (1-100, default 100)
* `requireBlueprint`: If true, blueprint required even if recipe listed
* `prop.model`: Model to show in preview (optional)
* `prop.offsetZ`: Vertical offset for preview model
* `blueprint.name`: Blueprint identifier (shared across multiple recipes)
* `blueprint.degrade`: Durability loss per craft (0-1, 0 = disabled)
* `tool.name`: Required tool item name
* `tool.degrade`: Tool durability loss per craft
* `isWeapon`: Set to `true` for weapon items

***
