There isn't too much to the installation, you just need to edit a few things in ox_inventory.
I also made sure not to interfere with the default crafting functionality if you're using that!
First we need to head to the file "ox_inventory/modules/inventory/server.lua", we're looking for the event "ox_inventory:closeInventory". We're going to add a new event hook for the scraping feature
local function createCraftingBench(id, data)
CraftingBenches[id] = {}
local recipes = data.items
if recipes then
for i = 1, #recipes do
local recipe = recipes[i]
local item = Items(recipe.name)
if item then
recipe.weight = item.weight
recipe.slot = i
else
warn(('failed to setup crafting recipe (bench: %s, slot: %s) - item "%s" does not exist'):format(id, i, recipe.name))
end
for ingredient, needs in pairs(recipe.ingredients) do
if needs < 1 then
item = Items(ingredient)
if item and not item.durability then
item.durability = true
end
end
end
end
if shared.target then
data.points = nil
else
data.zones = nil
end
CraftingBenches[id] = data
end
end exports('RegisterCraftStation', createCraftingBench)
local function deleteCraftingBench(ID)
table.remove(CraftingBenches, ID)
end exports("deleteCraftingBench", deleteCraftingBench)
local success = lib.callback.await('ox_inventory:startCrafting', source, id, recipeId)
local success = lib.callback.await('ox_inventory:startCrafting', source, recipe)