Code: Select all
function tablelength(T) ---it's to count how many ingredients is in recipe
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
for _, recipe in pairs(data.raw.recipe) do
if recipe.category ~= "pneumatic" and recipe.category ~="smelting" then
if tablelength(recipe.ingredients) < 3 then
local rec = recipe
local energy = recipe.energy_required
rec.name= recipe.name.."-P"
rec.ingredients[3]={type="fluid", name="compressed-air", amount=energy}
rec.category="pneumatic"
data:extend(rec)
end
end
end