I was wondering if there was a way to dump all recipes, technologies, etc, so that I could use them in an external tool.
Thanks in advance
Dump all recipes from the game
Re: Dump all recipes from the game
Those are already stored in a convenient format in data/base/prototypes/.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Dump all recipes from the game
yes, but if I have tons of mods, means I have to go through so many folders, its insane, also, many mods use variables in their recipes, where extracting them would take quite some time
Re: Dump all recipes from the game
Iterate over game.forces.player.recipes/technologies and pull out the stuff you care for.
See https://forums.factorio.com/wiki/inde ... Lua/Recipe and https://forums.factorio.com/wiki/inde ... Technology for what keys to find in there, iterate over tables therein and format output to taste. The "recepies" file will be put into the script-output directory.
Code: Select all
/c local foo = "" for k, v in pairs(game.forces.player.recipes) do foo = foo .. "recipe "..k.." has "..tostring(#v.ingredients).." ingredients\n" end game.makefile("recepies", foo)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Dump all recipes from the game
Heh that's what i was looking for too! Saving just recipe names is good enough for me.
Re: Dump all recipes from the game
Hey guys, I made a lua script to dump all recipes to a json file.
Just copy and paste in game console, then check file named `recipes` in script-output directory.
It's not formatted though.
Just copy and paste in game console, then check file named `recipes` in script-output directory.
It's not formatted though.
Code: Select all
/c
local out = ""
function write(...)
local arg = {...}
for i, v in ipairs(arg) do
out = out .. tostring(v)
end
end
function item_count(node)
local count = 0
for k, v in pairs(node) do
count = count + 1
end
return count
end
function traverse_table(node)
write("{")
level = level + 1
local i = 1
local count = item_count(node)
for k, v in pairs(node) do
write("\"", tostring(k), "\": ")
traverse(v)
if i < count then
write(",")
end
i = i + 1
end
write("}")
end
function traverse_array(node)
local count = item_count(node)
write("[")
for k, v in ipairs(node) do
traverse(v)
if k < count then
write(",")
end
end
write("]")
end
function traverse(node)
if type(node) == "table" then
if type(next(node)) == "number" then
traverse_array(node)
else
traverse_table(node)
end
elseif type(node) == "string" then
write("\"", node, "\"")
else
write(node)
end
end
function inspect_recipe(node)
return {
name=node.name,
category=node.category,
products=node.products,
ingredients=node.ingredients,
hidden=node.hidden,
energy=node.energy,
order=node.order
}
end
function inspect_all(recipes)
local r = {}
for k, v in pairs(recipes) do
r[k] = inspect_recipe(v)
end
traverse(r)
end
inspect_all(game.player.force.recipes)
game.makefile("recipes", out)
Re: Dump all recipes from the game
Same thing on github
https://github.com/antropod/factorio/tr ... mp_recipes
https://github.com/antropod/factorio/tr ... mp_recipes
Re: Dump all recipes from the game
You can take a look here:
serpent
Would make part of your scripts much easier to do I think and it's available by default.
serpent
Would make part of your scripts much easier to do I think and it's available by default.
Re: Dump all recipes from the game
Moved from general to gameplay help
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...