Actual Craft Time


Display actual craft times for assemblers, furnaces and rocket silo

Utilities
3 years ago
0.16 - 1.1
15.8K

g Mining productivity applying to all recipes

4 years ago
(updated 4 years ago)

Mining productivity is being applied across the board to all recipes. This is due to the expandProducts function applying mining productivity bonuses while also getting called by all machine types. You may wish to make a separate function for mining drill products, then call the mining function for the mining drills. This is an example of the fixed functions in control.lua:

local function expandProducts(products, sec, playerName, effects, recipeName)
if not playerName then
return {} --hopefully this never happens
end
local productTable = {}
local playerForce = game.players[playerName].force
for k,product in pairs(products) do
local amount = product.amount or product.max_amount or 1
local IPS = (amount * (effects.productivity.bonus + 1)) / sec
productTable[k] = product
productTable[k].localised_name = getLocalisedName(product.name)
productTable[k].ips = IPS
productTable[k].pbar = pbarTraits(IPS * global.ACT_slider[playerName][recipeName].value, playerName)
end
if recipeName == "rocket-part" then
local IPS = (10 * (effects.productivity.bonus + 1) * (playerForce.mining_drill_productivity_bonus + 1)) / sec
productTable[#products+1] = {amount = 10,
name = "space-science-pack",
type = "item",
localised_name = getLocalisedName("space-science-pack"),
ips = IPS,
pbar = pbarTraits(IPS * global.ACT_slider[playerName][recipeName].value, playerName)}
end
return productTable
end

local function expandProductsMines(products, sec, playerName, effects, recipeName)
if not playerName then
return {} --hopefully this never happens
end
local productTable = {}
local playerForce = game.players[playerName].force
for k,product in pairs(products) do
local amount = product.amount or product.max_amount or 1
local IPS = (amount * (effects.productivity.bonus + 1) * (playerForce.mining_drill_productivity_bonus + 1)) / sec
productTable[k] = product
productTable[k].localised_name = getLocalisedName(product.name)
productTable[k].ips = IPS
productTable[k].pbar = pbarTraits(IPS * global.ACT_slider[playerName][recipeName].value, playerName)
end
return productTable
end

Then change the function getRecipeFromMiningTarget for mining drills to have the products line call the new expandProductsMines function.

I have tested the above changes and they appear to fix the issue if folks want to manually edit until it gets fixed.

4 years ago

Nice catch, don't know how I missed that

New response