Basically this is the code:
Code: Select all
data.raw["assembling-machine"]["assembling-machine-1"].crafting_categories={"assembling"}
data.raw["assembling-machine"]["assembling-machine-2"].crafting_categories={"assembling"}
data.raw["assembling-machine"]["assembling-machine-3"].crafting_categories={"assembling"}
for i,d in pairs (data.raw.recipe) do
if string.find(d.name, "-steam", -6)==nil then
-- I do this ^ so recipes that alredy have steam dont get re-done with even more water in the
-- ingredients, and it doesnt go into an infinite loop.
if d.category=="crafting" then
recipeingredients={}
for ii,dd in pairs (d.ingredients) do
-- Here I convert the ingredient table, that can be done in two ways, to the
-- way that needs to be used when the ingredient table has a liquid.
if dd.type~=nil then
break
else
table.insert(recipeingredients,{name=dd[1],amount=dd[2],type="item"})
end
end
if d.result_count==nil then
amount=1
else
amount=d.result_count
end
if d.results==nil then
--Here I'm doing the same, but for the result
result={name=d.result, type="item", amount= amount}
else
result=d.results
end
table.insert(recipeingredients, {type="fluid",name="water", amount=d.energy_required})
-- And here I'm creating the new recipe, but with a -steam sufix and with the new ingredients.
data:extend{
{
type = "recipe",
name = d.name.."-steam",
results = result,
ingredients = recipeingredients,
enabled = d.enabled,
category = "assembling",
}
}
end
end
end
Code: Select all
Error while loading prototype "small-plane-steam", no such node (name)
The biggest problem is that it can be a "name" field from the recipe, a "name" field from the ingredients, or for the result.
The thing that I have been having more problems with is the result so it may be a "name" field from the result, but I have no idea why D:
If I could print stuff to a log somehow but the i/o api is dissabled in the data.lua afaik, the new functions to create file are also dissabled, and there is no console :S