This commit is contained in:
Brevven 2022-07-31 14:08:23 -07:00
parent 493ae32637
commit 2966df75bb
2 changed files with 23 additions and 1 deletions

View file

@ -1,9 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 0.0.12
Date:
Date: 2022-08-01
Changes:
- Accumulator recipe makes 2 now, but requires more batteries.
- Minor, tweak a K2 recipe icon
- Tweak bakelite item icon
- If enabled, alternate phenol recipe allows productivity
---------------------------------------------------------------------------------------------------
Version: 0.0.11
Date: 2022-07-31

View file

@ -282,6 +282,26 @@ function add_product(recipe, product)
end
end
-- Get the amount of the ingredient, will check base/normal not expensive
function util.get_ingredient_amount(recipe_name, ingredient_name)
local recipe = data.raw.recipe[recipe_name]
if recipe then
if recipe.normal and recipe.normal.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
if ingredient[1] == ingredient_name then return ingredient[2] end
if ingredient.name == ingredient_name then return ingredient.amount end
end
end
return 1
end
return 0
end
-- Get the amount of the result, will check base/normal not expensive
function util.get_amount(recipe_name, product)
if not product then product = recipe_name end