Last active
August 23, 2025 06:06
-
-
Save kaustubh-karkare/d7b474f2bc85a52217e12dc7e2b95bab to your computer and use it in GitHub Desktop.
Factorio / Foundry Recipe Comparison
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local lib = require("lib") | |
| local groupings = { | |
| { | |
| name = "iron-gear-wheel", | |
| input_item_name = "iron-ore", | |
| options = { | |
| { | |
| name = "iron-plate => iron-gear-wheel", | |
| }, | |
| { | |
| name = "casting-iron-plate => iron-gear-wheel", | |
| skipped_recipes = {"casting-iron-gear-wheel"}, | |
| use_foundry = true | |
| }, | |
| { | |
| name = "casting-iron-gear-wheel", | |
| use_foundry = true | |
| }, | |
| } | |
| }, | |
| { | |
| name = "iron-stick", | |
| input_item_name = "iron-ore", | |
| options = { | |
| { | |
| name = "iron-plate => iron-stick", | |
| productivity_module_bonus = 0.06, | |
| }, | |
| { | |
| name = "casting-iron-plate => iron-stick", | |
| productivity_module_bonus = 0.06, | |
| skipped_recipes = {"casting-iron-stick"}, | |
| use_foundry = true | |
| }, | |
| { | |
| name = "casting-iron-stick", | |
| productivity_module_bonus = 0.06, | |
| use_foundry = true | |
| }, | |
| }, | |
| }, | |
| { | |
| name = "steel-plate", | |
| input_item_name = "iron-ore", | |
| options = { | |
| { | |
| name = "iron-plate => steel-plate", | |
| }, | |
| { | |
| name = "casting-iron-plate => steel-plate", | |
| skipped_recipes = {"casting-steel"}, | |
| use_foundry = true | |
| }, | |
| { | |
| name = "casting-steel-plate", | |
| use_foundry = true | |
| }, | |
| }, | |
| }, | |
| { | |
| name = "pipe", | |
| input_item_name = "iron-ore", | |
| options = { | |
| { | |
| name = "iron-plate => pipe", | |
| }, | |
| { | |
| name = "casting-iron-plate => pipe", | |
| skipped_recipes = {"casting-pipe"}, | |
| use_foundry = true | |
| }, | |
| { | |
| name = "casting-pipe", | |
| use_foundry = true | |
| }, | |
| }, | |
| }, | |
| { | |
| name = "pipe-to-ground", | |
| input_item_name = "iron-ore", | |
| options = { | |
| { | |
| name = "iron-plate => pipe-to-ground", | |
| }, | |
| { | |
| name = "casting-iron-plate => pipe-to-ground", | |
| skipped_recipes = {"casting-pipe"}, | |
| use_foundry = true | |
| }, | |
| { | |
| name = "casting-pipe-to-ground", | |
| use_foundry = true | |
| }, | |
| }, | |
| }, | |
| { | |
| name = "copper-cable", | |
| input_item_name = "copper-ore", | |
| options = { | |
| { | |
| name = "copper-plate => copper-cable", | |
| }, | |
| { | |
| name = "casting-copper-plate => copper-cable", | |
| skipped_recipes = {"casting-copper-cable"}, | |
| use_foundry = true, | |
| }, | |
| { | |
| name = "casting-copper-cable", | |
| use_foundry = true, | |
| }, | |
| }, | |
| }, | |
| { | |
| name = "low-density-structure", | |
| input_item_name = "copper-ore", | |
| options = { | |
| { | |
| name = "iron/copper-plate => low-density-structure", | |
| }, | |
| { | |
| name = "casting-iron/copper-plate => low-density-structure", | |
| skipped_recipes = {"casting-low-density-structure"}, | |
| use_foundry = true, | |
| }, | |
| { | |
| name = "casting-low-density-structure", | |
| use_foundry = true | |
| }, | |
| }, | |
| } | |
| } | |
| local productivity_options = { | |
| [0] = 0.00, -- Nothing | |
| [1] = 0.04, -- Normal Q1 | |
| [2] = 0.06, -- Normal Q2 | |
| [3] = 0.10, -- Normal Q3 | |
| [4] = 0.15, -- Legendary QM2 | |
| [4] = 0.19, -- Epic Q3 | |
| [5] = 0.25, -- Legendary QM3 | |
| } | |
| local item_amount = 10 | |
| table_cols = { | |
| "Item Name", | |
| "Option Name", | |
| } | |
| for index, productivity_option in pairs(productivity_options) do | |
| table.insert(table_cols, productivity_option) | |
| end | |
| table_rows = {} | |
| for item_name, grouping in pairs(groupings) do | |
| item_name = grouping.name | |
| for _, config_input in pairs(grouping.options) do | |
| table_row = { | |
| ["Item Name"] = item_name, | |
| ["Option Name"] = config_input.name, | |
| } | |
| for _, productivity_option in pairs(productivity_options) do | |
| config_input.productivity_module_bonus = productivity_option | |
| config = lib.create_config(config_input) | |
| result = lib.create_result() | |
| lib.explore(item_name, item_amount, config, "", result) | |
| table_row[productivity_option] = string.format("%.2f", result.raw_items[grouping.input_item_name]) | |
| end | |
| table.insert(table_rows, table_row) | |
| end | |
| end | |
| print("Comparison of different Foundry strategies") | |
| lib.print_table(table_cols, table_rows) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The lib file can be found here.