Compare commits
2 commits
f4289dca70
...
f1de5a7c6e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f1de5a7c6e | ||
![]() |
a57c379f97 |
4 changed files with 32 additions and 139 deletions
|
@ -1,13 +1,5 @@
|
||||||
local util = {}
|
local util = {}
|
||||||
|
|
||||||
function util.get_stack_size(default)
|
|
||||||
if mods["Krastorio2"] then
|
|
||||||
size = tonumber(settings.startup["kr-stack-size"].value)
|
|
||||||
return size or default
|
|
||||||
end
|
|
||||||
return default
|
|
||||||
end
|
|
||||||
|
|
||||||
-- se landfill
|
-- se landfill
|
||||||
-- params: ore, icon_size
|
-- params: ore, icon_size
|
||||||
function util.se_landfill(params)
|
function util.se_landfill(params)
|
||||||
|
@ -153,9 +145,7 @@ end
|
||||||
function util.get_normal(recipe_name)
|
function util.get_normal(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
recipe = data.raw.recipe[recipe_name]
|
recipe = data.raw.recipe[recipe_name]
|
||||||
if recipe.normal and recipe.normal.ingredients then
|
if recipe.ingredients then
|
||||||
return recipe.normal
|
|
||||||
elseif recipe.ingredients then
|
|
||||||
return recipe
|
return recipe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -257,17 +247,13 @@ end
|
||||||
|
|
||||||
function util.set_enabled(recipe_name, enabled)
|
function util.set_enabled(recipe_name, enabled)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.enabled = enabled end
|
data.raw.recipe[recipe_name].enabled = enabled
|
||||||
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.enabled = enabled end
|
|
||||||
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].enabled = enabled end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.set_hidden(recipe_name)
|
function util.set_hidden(recipe_name)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
if data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].normal.hidden = true end
|
data.raw.recipe[recipe_name].hidden = true
|
||||||
if data.raw.recipe[recipe_name].expensive then data.raw.recipe[recipe_name].expensive.hidden = true end
|
|
||||||
if not data.raw.recipe[recipe_name].normal then data.raw.recipe[recipe_name].hidden = true end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -275,8 +261,6 @@ end
|
||||||
function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity)
|
function util.add_or_add_to_ingredient(recipe_name, ingredient, quantity)
|
||||||
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
||||||
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
add_or_add_to_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||||
add_or_add_to_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
|
||||||
add_or_add_to_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -297,22 +281,20 @@ function util.add_ingredient(recipe_name, ingredient, quantity)
|
||||||
local is_fluid = not not data.raw.fluid[ingredient]
|
local is_fluid = not not data.raw.fluid[ingredient]
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient] or is_fluid) then
|
||||||
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
add_ingredient(data.raw.recipe[recipe_name], ingredient, quantity, is_fluid)
|
||||||
add_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity, is_fluid)
|
|
||||||
add_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity, is_fluid)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function add_ingredient(recipe, ingredient, quantity, is_fluid)
|
function add_ingredient(recipe, ingredient, quantity, is_fluid)
|
||||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||||
for i, existing in pairs(recipe.ingredients) do
|
for i, existing in pairs(recipe.ingredients) do
|
||||||
if existing[1] == ingredient or existing.name == ingredient then
|
if existing.name == ingredient then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if is_fluid then
|
if is_fluid then
|
||||||
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
|
table.insert(recipe.ingredients, {type="fluid", name=ingredient, amount=quantity})
|
||||||
else
|
else
|
||||||
table.insert(recipe.ingredients, {ingredient, quantity})
|
table.insert(recipe.ingredients, {type = "item", name = ingredient, amount = quantity})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -321,8 +303,6 @@ end
|
||||||
function util.add_ingredient_raw(recipe_name, ingredient)
|
function util.add_ingredient_raw(recipe_name, ingredient)
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[ingredient.name] or data.raw.item[ingredient[1]]) then
|
||||||
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
|
add_ingredient_raw(data.raw.recipe[recipe_name], ingredient)
|
||||||
add_ingredient_raw(data.raw.recipe[recipe_name].normal, ingredient)
|
|
||||||
add_ingredient_raw(data.raw.recipe[recipe_name].expensive, ingredient)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -344,8 +324,6 @@ end
|
||||||
function util.set_ingredient(recipe_name, ingredient, quantity)
|
function util.set_ingredient(recipe_name, ingredient, quantity)
|
||||||
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
if data.raw.recipe[recipe_name] and data.raw.item[ingredient] then
|
||||||
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
set_ingredient(data.raw.recipe[recipe_name], ingredient, quantity)
|
||||||
set_ingredient(data.raw.recipe[recipe_name].normal, ingredient, quantity)
|
|
||||||
set_ingredient(data.raw.recipe[recipe_name].expensive, ingredient, quantity)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -369,25 +347,18 @@ end
|
||||||
-- Only works for recipes with multiple products
|
-- Only works for recipes with multiple products
|
||||||
function util.add_product(recipe_name, product)
|
function util.add_product(recipe_name, product)
|
||||||
if data.raw.recipe[recipe_name] and
|
if data.raw.recipe[recipe_name] and
|
||||||
(data.raw.item[product[1]] or data.raw.item[product.name] or
|
(data.raw.item[product.name] or data.raw.fluid[product.name]) then
|
||||||
data.raw.fluid[product[1]] or data.raw.fluid[product.name]
|
local is_fluid = data.raw.fluid[product.name]
|
||||||
) then
|
add_product(data.raw.recipe[recipe_name], product, is_fluid)
|
||||||
add_product(data.raw.recipe[recipe_name], product)
|
|
||||||
add_product(data.raw.recipe[recipe_name].normal, product)
|
|
||||||
add_product(data.raw.recipe[recipe_name].expensive, product)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function add_product(recipe, product)
|
function add_product(recipe, product, is_fluid)
|
||||||
if recipe ~= nil then
|
if recipe ~= nil then
|
||||||
if not recipe.normal then
|
if recipe.results == nil then
|
||||||
if recipe.results == nil then
|
recipe.results = {}
|
||||||
recipe.results = {{recipe.result, recipe.result_count and recipe.result_count or 1}}
|
|
||||||
end
|
|
||||||
recipe.result = nil
|
|
||||||
recipe.result_count = nil
|
|
||||||
table.insert(recipe.results, product)
|
|
||||||
end
|
end
|
||||||
|
table.insert(recipe.results, {type = is_fluid and "fluid" or "item", name = product.result, amount = product.result_count and product.result_count or 1})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -395,14 +366,8 @@ end
|
||||||
function util.get_ingredient_amount(recipe_name, ingredient_name)
|
function util.get_ingredient_amount(recipe_name, ingredient_name)
|
||||||
local recipe = data.raw.recipe[recipe_name]
|
local recipe = data.raw.recipe[recipe_name]
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.normal and recipe.normal.ingredients then
|
if recipe.ingredients then
|
||||||
for i, ingredient in pairs(recipe.normal.ingredients) do
|
|
||||||
if ingredient[1] == ingredient_name then return ingredient[2] end
|
|
||||||
if ingredient.name == ingredient_name then return ingredient.amount end
|
|
||||||
end
|
|
||||||
elseif recipe.ingredients then
|
|
||||||
for i, ingredient in pairs(recipe.ingredients) do
|
for i, ingredient in pairs(recipe.ingredients) do
|
||||||
if ingredient[1] == ingredient_name then return ingredient[2] end
|
|
||||||
if ingredient.name == ingredient_name then return ingredient.amount end
|
if ingredient.name == ingredient_name then return ingredient.amount end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -416,35 +381,10 @@ function util.get_amount(recipe_name, product)
|
||||||
if not product then product = recipe_name end
|
if not product then product = recipe_name end
|
||||||
local recipe = data.raw.recipe[recipe_name]
|
local recipe = data.raw.recipe[recipe_name]
|
||||||
if recipe then
|
if recipe then
|
||||||
if recipe.normal and recipe.normal.results then
|
if recipe.results then
|
||||||
for i, result in pairs(recipe.normal.results) do
|
|
||||||
if result[1] == product then return result[2] end
|
|
||||||
if result.name == product then return result.amount end
|
|
||||||
end
|
|
||||||
elseif recipe.normal and recipe.normal.result_count then
|
|
||||||
return recipe.normal.result_count
|
|
||||||
elseif recipe.results then
|
|
||||||
for i, result in pairs(recipe.results) do
|
for i, result in pairs(recipe.results) do
|
||||||
if result[1] == product then return result[2] end
|
|
||||||
if result.name == product then return result.amount end
|
if result.name == product then return result.amount end
|
||||||
end
|
end
|
||||||
elseif recipe.result_count then
|
|
||||||
return recipe.result_count
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Get the count of results
|
|
||||||
function util.get_result_count(recipe_name, product)
|
|
||||||
if not product then product = recipe_name end
|
|
||||||
local recipe = data.raw.recipe[recipe_name]
|
|
||||||
if recipe then
|
|
||||||
if recipe.normal and recipe.normal.results then
|
|
||||||
return #(recipe.normal.results)
|
|
||||||
elseif recipe.results then
|
|
||||||
return #(recipe.results)
|
|
||||||
end
|
end
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
@ -456,38 +396,24 @@ end
|
||||||
function util.replace_ingredient(recipe_name, old, new, amount, multiply)
|
function util.replace_ingredient(recipe_name, old, new, amount, multiply)
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[new] or data.raw.fluid[new]) then
|
||||||
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
|
replace_ingredient(data.raw.recipe[recipe_name], old, new, amount, multiply)
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].normal, old, new, amount, multiply)
|
|
||||||
replace_ingredient(data.raw.recipe[recipe_name].expensive, old, new, amount, multiply)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function replace_ingredient(recipe, old, new, amount, multiply)
|
function replace_ingredient(recipe, old, new, amount, multiply)
|
||||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||||
for i, existing in pairs(recipe.ingredients) do
|
for i, existing in pairs(recipe.ingredients) do
|
||||||
if existing[1] == new or existing.name == new then
|
if existing.name == new then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for i, ingredient in pairs(recipe.ingredients) do
|
for i, ingredient in pairs(recipe.ingredients) do
|
||||||
if ingredient.name == old then
|
if ingredient.name == old then
|
||||||
ingredient.name = new
|
ingredient.name = new
|
||||||
if amount then
|
|
||||||
if multiply then
|
if multiply then
|
||||||
ingredient.amount = amount * ingredient.amount
|
ingredient.amount = amount * ingredient.amount
|
||||||
else
|
else
|
||||||
ingredient.amount = amount
|
ingredient.amount = amount
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
if ingredient[1] == old then
|
|
||||||
ingredient[1] = new
|
|
||||||
if amount then
|
|
||||||
if multiply then
|
|
||||||
ingredient[2] = amount * ingredient[2]
|
|
||||||
else
|
|
||||||
ingredient[2] = amount
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -497,8 +423,6 @@ end
|
||||||
function util.remove_ingredient(recipe_name, old)
|
function util.remove_ingredient(recipe_name, old)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
remove_ingredient(data.raw.recipe[recipe_name], old)
|
remove_ingredient(data.raw.recipe[recipe_name], old)
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].normal, old)
|
|
||||||
remove_ingredient(data.raw.recipe[recipe_name].expensive, old)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -506,7 +430,7 @@ function remove_ingredient(recipe, old)
|
||||||
index = -1
|
index = -1
|
||||||
if recipe ~= nil and recipe.ingredients ~= nil then
|
if recipe ~= nil and recipe.ingredients ~= nil then
|
||||||
for i, ingredient in pairs(recipe.ingredients) do
|
for i, ingredient in pairs(recipe.ingredients) do
|
||||||
if ingredient.name == old or ingredient[1] == old then
|
if ingredient.name == old then
|
||||||
index = i
|
index = i
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -522,8 +446,6 @@ function util.replace_some_ingredient(recipe_name, old, old_amount, new, new_amo
|
||||||
local is_fluid = not not data.raw.fluid[new]
|
local is_fluid = not not data.raw.fluid[new]
|
||||||
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
if data.raw.recipe[recipe_name] and (data.raw.item[new] or is_fluid) then
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
replace_some_ingredient(data.raw.recipe[recipe_name], old, old_amount, new, new_amount, is_fluid)
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name].normal, old, old_amount, new, new_amount, is_fluid)
|
|
||||||
replace_some_ingredient(data.raw.recipe[recipe_name].expensive, old, old_amount, new, new_amount, is_fluid)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -550,8 +472,6 @@ end
|
||||||
function util.set_product_amount(recipe_name, product, amount)
|
function util.set_product_amount(recipe_name, product, amount)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
set_product_amount(data.raw.recipe[recipe_name], product, amount)
|
set_product_amount(data.raw.recipe[recipe_name], product, amount)
|
||||||
set_product_amount(data.raw.recipe[recipe_name].normal, product, amount)
|
|
||||||
set_product_amount(data.raw.recipe[recipe_name].expensive, product, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -588,8 +508,6 @@ end
|
||||||
function util.multiply_recipe(recipe_name, multiple)
|
function util.multiply_recipe(recipe_name, multiple)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
multiply_recipe(data.raw.recipe[recipe_name], multiple)
|
multiply_recipe(data.raw.recipe[recipe_name], multiple)
|
||||||
multiply_recipe(data.raw.recipe[recipe_name].normal, multiple)
|
|
||||||
multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -639,9 +557,8 @@ end
|
||||||
|
|
||||||
-- Returns true if a recipe has an ingredient
|
-- Returns true if a recipe has an ingredient
|
||||||
function util.has_ingredient(recipe_name, ingredient)
|
function util.has_ingredient(recipe_name, ingredient)
|
||||||
return data.raw.recipe[recipe_name] and (
|
return data.raw.recipe[recipe_name] and
|
||||||
has_ingredient(data.raw.recipe[recipe_name], ingredient) or
|
has_ingredient(data.raw.recipe[recipe_name], ingredient)
|
||||||
has_ingredient(data.raw.recipe[recipe_name].normal, ingredient))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function has_ingredient(recipe, ingredient)
|
function has_ingredient(recipe, ingredient)
|
||||||
|
@ -659,8 +576,6 @@ end
|
||||||
function util.remove_product(recipe_name, old)
|
function util.remove_product(recipe_name, old)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
remove_product(data.raw.recipe[recipe_name], old)
|
remove_product(data.raw.recipe[recipe_name], old)
|
||||||
remove_product(data.raw.recipe[recipe_name].normal, old)
|
|
||||||
remove_product(data.raw.recipe[recipe_name].expensive, old)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -682,8 +597,6 @@ end
|
||||||
function util.set_main_product(recipe_name, product)
|
function util.set_main_product(recipe_name, product)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
set_main_product(data.raw.recipe[recipe_name], product)
|
set_main_product(data.raw.recipe[recipe_name], product)
|
||||||
set_main_product(data.raw.recipe[recipe_name].normal, product)
|
|
||||||
set_main_product(data.raw.recipe[recipe_name].expensive, product)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -697,8 +610,6 @@ end
|
||||||
function util.replace_product(recipe_name, old, new)
|
function util.replace_product(recipe_name, old, new)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
replace_product(data.raw.recipe[recipe_name], old, new)
|
replace_product(data.raw.recipe[recipe_name], old, new)
|
||||||
replace_product(data.raw.recipe[recipe_name].normal, old, new)
|
|
||||||
replace_product(data.raw.recipe[recipe_name].expensive, old, new)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -740,8 +651,6 @@ end
|
||||||
function util.set_recipe_time(recipe_name, time)
|
function util.set_recipe_time(recipe_name, time)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
set_recipe_time(data.raw.recipe[recipe_name], time)
|
set_recipe_time(data.raw.recipe[recipe_name], time)
|
||||||
set_recipe_time(data.raw.recipe[recipe_name].normal, time)
|
|
||||||
set_recipe_time(data.raw.recipe[recipe_name].expensive, time)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -757,8 +666,6 @@ end
|
||||||
function util.multiply_time(recipe_name, factor)
|
function util.multiply_time(recipe_name, factor)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
multiply_time(data.raw.recipe[recipe_name], factor)
|
multiply_time(data.raw.recipe[recipe_name], factor)
|
||||||
multiply_time(data.raw.recipe[recipe_name].normal, factor)
|
|
||||||
multiply_time(data.raw.recipe[recipe_name].expensive, factor)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -774,8 +681,6 @@ end
|
||||||
function util.add_time(recipe_name, amount)
|
function util.add_time(recipe_name, amount)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
add_time(data.raw.recipe[recipe_name], amount)
|
add_time(data.raw.recipe[recipe_name], amount)
|
||||||
add_time(data.raw.recipe[recipe_name].normal, amount)
|
|
||||||
add_time(data.raw.recipe[recipe_name].expensive, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -874,8 +779,6 @@ end
|
||||||
function util.add_to_ingredient(recipe, ingredient, amount)
|
function util.add_to_ingredient(recipe, ingredient, amount)
|
||||||
if data.raw.recipe[recipe] then
|
if data.raw.recipe[recipe] then
|
||||||
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
|
add_to_ingredient(data.raw.recipe[recipe], ingredient, amount)
|
||||||
add_to_ingredient(data.raw.recipe[recipe].normal, ingredient, amount)
|
|
||||||
add_to_ingredient(data.raw.recipe[recipe].expensive, ingredient, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -897,8 +800,6 @@ end
|
||||||
function util.add_to_product(recipe_name, product, amount)
|
function util.add_to_product(recipe_name, product, amount)
|
||||||
if data.raw.recipe[recipe_name] then
|
if data.raw.recipe[recipe_name] then
|
||||||
add_to_product(data.raw.recipe[recipe_name], product, amount)
|
add_to_product(data.raw.recipe[recipe_name], product, amount)
|
||||||
add_to_product(data.raw.recipe[recipe_name].normal, product, amount)
|
|
||||||
add_to_product(data.raw.recipe[recipe_name].expensive, product, amount)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1033,15 +934,7 @@ function util.sum_products(recipe_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function util.add_productivity(recipe)
|
function util.add_productivity(recipe)
|
||||||
for i, module in pairs(data.raw.module) do
|
data.raw.recipe[recipe].allow_productivity = true
|
||||||
if module.effect then
|
|
||||||
for effect_name, effect in pairs(module.effect) do
|
|
||||||
if effect_name == "productivity" and effect.bonus > 0 and module.limitation and #module.limitation > 0 then
|
|
||||||
table.insert(module.limitation, recipe)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return util
|
return util
|
|
@ -65,6 +65,6 @@ data:extend({
|
||||||
icon = "__Chromium__/graphics/icons/chromite-ore.png",
|
icon = "__Chromium__/graphics/icons/chromite-ore.png",
|
||||||
subgroup = "raw-resource",
|
subgroup = "raw-resource",
|
||||||
order = "t-c-a",
|
order = "t-c-a",
|
||||||
stack_size = util.get_stack_size(50)
|
stack_size = 50
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,7 @@ data:extend(
|
||||||
group ="raw-material",
|
group ="raw-material",
|
||||||
subgroup = "chromium",
|
subgroup = "chromium",
|
||||||
order = "a",
|
order = "a",
|
||||||
stack_size = util.get_stack_size(100)
|
stack_size = 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
|
|
@ -22,7 +22,7 @@ data:extend({
|
||||||
icon_size = 64,
|
icon_size = 64,
|
||||||
subgroup = "chromium",
|
subgroup = "chromium",
|
||||||
order = "b[chromium-plate]",
|
order = "b[chromium-plate]",
|
||||||
stack_size = util.get_stack_size(100)
|
stack_size = 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -91,7 +91,7 @@ data:extend({
|
||||||
icon_size = 64,
|
icon_size = 64,
|
||||||
subgroup = "chromium",
|
subgroup = "chromium",
|
||||||
order = "b[stainless-steel-plate]",
|
order = "b[stainless-steel-plate]",
|
||||||
stack_size = util.get_stack_size(100),
|
stack_size = 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -147,7 +147,7 @@ data:extend({
|
||||||
icon_size = 64,
|
icon_size = 64,
|
||||||
subgroup = "chromium",
|
subgroup = "chromium",
|
||||||
order = "c[chromel-r-fabric]",
|
order = "c[chromel-r-fabric]",
|
||||||
stack_size = util.get_stack_size(100),
|
stack_size = 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -173,7 +173,7 @@ data:extend({
|
||||||
icon_size = 128,
|
icon_size = 128,
|
||||||
subgroup = "intermediate-product",
|
subgroup = "intermediate-product",
|
||||||
order = "v[basic-vehicle-frame]",
|
order = "v[basic-vehicle-frame]",
|
||||||
stack_size = util.get_stack_size(100),
|
stack_size = 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -199,7 +199,7 @@ data:extend({
|
||||||
icon_size = 128,
|
icon_size = 128,
|
||||||
subgroup = "intermediate-product",
|
subgroup = "intermediate-product",
|
||||||
order = "v[vehicle-frame]",
|
order = "v[vehicle-frame]",
|
||||||
stack_size = util.get_stack_size(100),
|
stack_size = 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -232,7 +232,7 @@ data:extend({
|
||||||
group = "intermediate-products",
|
group = "intermediate-products",
|
||||||
subgroup = inconel_subgroup,
|
subgroup = inconel_subgroup,
|
||||||
order = "i",
|
order = "i",
|
||||||
stack_size = util.get_stack_size(100),
|
stack_size = 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -261,7 +261,7 @@ end
|
||||||
group = "intermediate-product",
|
group = "intermediate-product",
|
||||||
subgroup = automation_core3_subgroup,
|
subgroup = automation_core3_subgroup,
|
||||||
order = "d",
|
order = "d",
|
||||||
stack_size = util.get_stack_size(50),
|
stack_size = 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -295,7 +295,7 @@ data:extend({
|
||||||
group = "intermediate-products",
|
group = "intermediate-products",
|
||||||
subgroup = turbines_blade_subgroup,
|
subgroup = turbines_blade_subgroup,
|
||||||
order = "t",
|
order = "t",
|
||||||
stack_size = util.get_stack_size(50),
|
stack_size = 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -326,7 +326,7 @@ data:extend({
|
||||||
group = "intermediate-products",
|
group = "intermediate-products",
|
||||||
subgroup = hrld_structure_subgroup,
|
subgroup = hrld_structure_subgroup,
|
||||||
order = "h",
|
order = "h",
|
||||||
stack_size = util.get_stack_size(50),
|
stack_size = 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -349,7 +349,7 @@ data:extend({
|
||||||
group = "intermediate-products",
|
group = "intermediate-products",
|
||||||
subgroup = "intermediate-product",
|
subgroup = "intermediate-product",
|
||||||
order = "h",
|
order = "h",
|
||||||
stack_size = util.get_stack_size(100),
|
stack_size = 100,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
@ -380,7 +380,7 @@ data:extend({
|
||||||
group = "intermediate-products",
|
group = "intermediate-products",
|
||||||
subgroup = advanced_electric_motor_subgroup,
|
subgroup = advanced_electric_motor_subgroup,
|
||||||
order = "g",
|
order = "g",
|
||||||
stack_size = util.get_stack_size(50),
|
stack_size = 50,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type = "recipe",
|
type = "recipe",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue