Instant Craft deprecated


Removes crafting time for players, allowing for instant, but not free crafting.

Tweaks
28 days ago
1.1 - 2.0
1.56K
Cheats

g Bug with recipes with random products

a month ago

Hi, I got a post here about a bug where recipes with percentage outputs will always produce 1 when using Instant Craft with that mod. The bug probably doesn't show up in vanilla or with most other mods because they don't have hand-craftable recipes with random outputs.

I think it is caused by the code here using recipe.product.amount and assuming 1 when it is not present, instead of amount_min/amount_max/percentage in the recipe.product. If that is the issue I think you can fix it by replacing this line product_to_insert.count=(product.amount or 1)*count with the code below (I haven't tested it though)

if product.amount ~= nil then
    product_to_insert.count = product.amount * count
elseif product.probability ~= nil and math.random() > product.probability then
    product_to_insert.count = 0
else
    local amount = product.amount_min + math.random() * (product.amount_max - product.amount_min)
    product_to_insert.count = math.floor(amount * count)
end

New response