Labs
By default, all laboratories process items from the Ingredients stash and convert them directly into another product, which is added to the Products stash.
If you want to replace this process, you can use the customProcess
function located in av_gangs\server\editable\labs.lua
.
This is an example of processing money laundering laboratories where the item in the Ingredients stash is markedbills
, which contains metadata. We will use that metadata to calculate the output using the worth
value and multiplying it by the quantity of markedbills
. The output is the item cash
.
function customProcess(identifier, lab, gang, ingredientStash, productStash)
local processed = false
local type = lab and lab['type'] or false
if type and type == "laundromat" then
local items = exports['av_laptop']:getStashItems(ingredientStash)
local toAdd = 0
if items and next(items) then
for k, v in pairs(items) do
if v['name'] == "markedbills" then
local metadata = v['metadata'] or v['info'] or {}
local worth = metadata['worth'] or 0
toAdd += worth
end
end
if toAdd > 0 then
exports['av_laptop']:wipeStash(ingredientStash)
exports['av_laptop']:addToStash(productStash, "cash", toAdd)
end
end
processed = true
end
return processed
end
Last updated