Items Setup
To use the crafting system, you need to register the required items in your inventory system. This includes the crafting bench placement items, upgrade items, and any materials/recipes you've configured.
Default Items
The resource includes example item definitions in setup_inv_items.lua for reference. You'll need to add these items to your inventory system.
ox_inventory Items
Add these items to your ox_inventory/data/items.lua file:
Crafting Bench
['crafting_bench'] = {
label = 'Crafting Bench',
consume = 0,
weight = 100,
stack = false,
close = false,
client = {
export = "sleepless_crafting.placeCraftStation",
}
},The client.export property automatically calls the placement function when the item is used. This is required for placing crafting stations.
Upgrade Items
['bench_upgrade_2'] = {
label = 'Crafting Bench Upgrade Tier 2',
weight = 50,
stack = false,
close = false,
},
['bench_upgrade_3'] = {
label = 'Crafting Bench Upgrade Tier 3',
weight = 75,
stack = false,
close = false,
},
['bench_upgrade_4'] = {
label = 'Crafting Bench Upgrade Tier 4',
weight = 100,
stack = false,
close = false,
},Custom Station Types
If you create additional station types in stationTypes.lua, you'll need to create corresponding items for each one.
For example, if you add a cooking station type:
["cooking"] = {
placeItem = 'cooking_station',
-- ... rest of config
}You'll need to add the cooking_station item:
['cooking_station'] = {
label = 'Cooking Station',
consume = 0,
weight = 150,
stack = false,
close = false,
client = {
export = "sleepless_crafting.placeCraftStation",
}
},Recipe Materials
Don't forget to also register all the materials and output items used in your recipes. For example, if your recipe requires scrapcloth and vodka to craft a bandage:
['scrapcloth'] = {
label = 'Scrap Cloth',
weight = 10,
},
['vodka'] = {
label = 'Vodka',
weight = 50,
},
['bandage'] = {
label = 'Bandage',
weight = 20,
},Item Images
You'll need to add images for your items to your inventory's image folder:
- ox_inventory:
ox_inventory/web/images/ - qb-inventory:
qb-inventory/html/images/
For best results, use PNG images with a transparent background. The recommended size is 100x100 pixels.
Checklist
Before starting your server, make sure you have:
- Added the crafting bench placement item(s)
- Added upgrade items for each tier (if using upgrades)
- Added all material items used in recipes
- Added all output items from recipes
- Added images for all items
- Restarted your inventory resource after adding items