i tried different solutions, wich i found, but no ones helps.
I tried to wrote a script but there is an error. pls help me
script is saved in control.lua
Code: Select all
script.on_init 
(function() ReplaceAllIngredientItemWithItem(iron-plate, carbon-plate)
	for i, recipe in pairs(data.raw["recipe"]) do
		for v, ingredient in pairs(data.raw["recipe"][recipe.name].ingredients) do
			if ingredient.name == iron-plate then
				RemoveFromRecipe(recipe.name,iron-plate)
				AddToRecipe(recipe.name, carbon-plate, ingredient.amount)
			elseif ingredient[1] == iron-plate then
				RemoveFromRecipe(recipe.name,iron-plate)
				AddToRecipe(recipe.name, carbon-plate, ingredient[2])
			end
		end
	end)


