-- make expensive function double_ingredients (handler) if handler.ingredients then for i, ingredient in pairs (handler.ingredients) do if ingredient[2] then ingredient[2] = ingredient[2]*2 end if ingredient.amount then ingredient[2] = ingredient.amount*2 end end end end function double_time (handler) if handler.energy_required then if handler.energy_required then handler.energy_required = handler.energy_required * 2 end else handler.energy_required = 1 -- default energy_required is 0.5 end end for recipe_name, recipe in pairs (data.raw.recipe) do if not recipe.expensive then local normal = {} -- ingredients if recipe.ingredients then normal.ingredients = table.deepcopy(recipe.ingredients) recipe.ingredients = nil else log ('no ingredients by '..recipe_name) end -- result and results if recipe.result then normal.result = recipe.result -- not a table recipe.result = nil else log ('no result by '..recipe_name) end if recipe.results then normal.results = table.deepcopy(recipe.results) recipe.results = nil else log ('no results by '..recipe_name) end -- other stuff if recipe.enabled or recipe.enabled == false then normal.enabled = recipe.enabled -- not a table recipe.enabled = nil else log ('no enabled by '..recipe_name) end if recipe.energy_required then normal.energy_required = recipe.energy_required -- not a table recipe.energy_required = nil else log ('no energy_required by '..recipe_name) end if recipe.result_count then normal.result_count = recipe.result_count -- not a table recipe.result_count = nil else log ('no result_count by '..recipe_name) end recipe.normal = normal recipe.expensive = table.deepcopy(normal) double_ingredients (recipe.expensive) double_time (recipe.expensive) end end