123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- local recipes = {
- ["technic:mv_centrifuge"] = {
- craft = {
- {"basic_materials:motor", "technic:copper_plate", "technic:diamond_drill_head"},
- {"technic:copper_plate", "technic:machine_casing", "technic:copper_plate"},
- {"pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter"}
- }
- },
- ["basic_materials:motor"] = {
- craft = {
- {"default:mese_crystal_fragment", "basic_materials:copper_wire", "basic_materials:plastic_sheet"},
- {"default:copper_ingot", "default:steel_ingot", "default:steel_ingot"},
- {"default:mese_crystal_fragment", "basic_materials:copper_wire", "basic_materials:plastic_sheet"}
- },
- produces = 2
- },
- ["technic:copper_plate"] = {
- compress = {
- item = "technic:copper_ingot",
- amount = 5
- }
- },
- ["technic:diamond_drill_head"] = {
- craft = {
- {"technic:stainless_steel_ingot", "default:diamond", "technic:stainless_steel_ingot"},
- {"default:diamond", "", "default:diamond"},
- {"technic:stainless_steel_ingot", "default:diamond", "technic:stainless_steel_ingot"}
- }
- },
- ["technic:stainless_steel_ingot"] = {
- alloy = {
- ["technic:carbon_steel_ingot"] = 3,
- ["technic:chromium_ingot"] = 1
- },
- produces = 4
- },
- ["technic:carbon_steel_ingot"] = {
- alloy = {
- ["default:steel_ingot"] = 1,
- ["technic:coal_dust"] = 1
- }
- },
- ["technic:machine_casing"] = {
- craft = {
- {"technic:cast_iron_ingot", "technic:cast_iron_ingot", "technic:cast_iron_ingot"},
- {"technic:cast_iron_ingot", "basic_materials:brass_ingot", "technic:cast_iron_ingot"},
- {"technic:cast_iron_ingot", "technic:cast_iron_ingot", "technic:cast_iron_ingot"}
- }
- },
- ["basic_materials:brass_ingot"] = {
- alloy = {
- ["default:copper_ingot"] = 2,
- ["technic:zinc_ingot"] = 1
- },
- produces = 3
- },
- ["technic:cast_iron_ingot"] = {
- smelt = "default:steel_ingot"
- },
- ["pipeworks:one_way_tube"] = {
- craft = {
- {"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"},
- {"default:stick", "default:mese_crystal", "basic_materials:plastic_sheet"},
- {"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"}
- },
- produces = 2
- },
- ["technic:mv_cable"] = {
- craft = {
- {"technic:rubber", "technic:rubber", "technic:rubber"},
- {"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"},
- {"technic:rubber", "technic:rubber", "technic:rubber"}
- },
- produces = 3
- },
- ["technic:rubber"] = {
- alloy = {
- ["technic:raw_latex"] = 4,
- ["technic:coal_dust"] = 2
- },
- produces = 6
- },
- ["technic:raw_latex"] = {
- extract = {
- item = "technic:rubber_tree_grindings",
- amount = 4
- }
- },
- ["technic:lv_cable"] = {
- craft = {
- {"default:paper", "default:paper", "default:paper"},
- {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
- {"default:paper", "default:paper", "default:paper"}
- },
- produces = 6
- },
- ["default:paper"] = {
- craft = {
- {"", "", ""},
- {"default:papyrus", "default:papyrus", "default:papyrus"},
- {"", "", ""}
- },
- produces = 4
- },
- ["pipeworks:mese_filter"] = {
- craft = {
- {"default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet"},
- {"default:stick", "default:mese", "basic_materials:plastic_sheet"},
- {"default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet"}
- },
- produces = 2
- },
- ["default:mese"] = {
- craft = {
- {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
- {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"},
- {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}
- }
- },
- ["default:mese_crystal_fragment"] = {
- craft = {
- {"", "", ""},
- {"", "default:mese_crystal", ""},
- {"", "", ""}
- },
- produces = 9
- },
- ["basic_materials:copper_wire"] = {
- craft = {
- {"default:copper_ingot", "basic_materials:empty_spool", ""},
- {"basic_materials:empty_spool", "", ""},
- {"", "", ""}
- },
- produces = 2
- },
- ["basic_materials:empty_spool"] = {
- craft = {
- {"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"},
- {"", "basic_materials:plastic_sheet", ""},
- {"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet"}
- },
- produces = 3
- },
- ["basic_materials:plastic_sheet"] = {
- smelt = "basic_materials:paraffin"
- },
- ["basic_materials:paraffin"] = {
- smelt = "basic_materials:oil_extract"
- },
- ["technic:solar_panel"] = {
- craft = {
- {"technic:doped_silicon_wafer", "technic:doped_silicon_wafer", "technic:doped_silicon_wafer"},
- {"basic_materials:silver_wire", "technic:lv_cable", "mesecons_materials:glue"},
- {"", "", ""}
- }
- },
- ["technic:doped_silicon_wafer"] = {
- alloy = {
- ["technic:silicon_wafer"] = 1,
- ["technic:gold_dust"] = 1
- }
- },
- ["technic:silicon_wafer"] = {
- alloy = {
- ["default:sand"] = 2,
- ["technic:coal_dust"] = 2
- }
- },
- ["basic_materials:silver_wire"] = {
- craft = {
- {"moreores:silver_ingot", "basic_materials:empty_spool", ""},
- {"basic_materials:empty_spool", "", ""},
- {"", "", ""}
- },
- produces = 2
- },
- ["mesecons_materials:glue"] = {
- smelt = "technic:raw_latex"
- },
- ["technic:solar_array_lv"] = {
- craft = {
- {"technic:solar_panel", "technic:solar_panel", "technic:solar_panel"},
- {"technic:carbon_steel_ingot", "technic:lv_transformer", "technic:carbon_steel_ingot"},
- {"", "technic:lv_cable", ""}
- }
- },
- ["technic:lv_transformer"] = {
- craft = {
- {"mesecons_materials:fiber", "default:steel_ingot", "mesecons_materials:fiber"},
- {"technic:copper_coil", "default:steel_ingot", "technic:copper_coil"},
- {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
- }
- },
- ["mesecons_materials:fiber"] = {
- smelt = "mesecons_materials:glue",
- produces = 6
- },
- ["technic:copper_coil"] = {
- craft = {
- {"basic_materials:copper_wire", "default:steel_ingot", "basic_materials:copper_wire"},
- {"default:steel_ingot", "", "default:steel_ingot"},
- {"basic_materials:copper_wire", "default:steel_ingot", "basic_materials:copper_wire"}
- }
- },
- ["technic:solar_array_mv"] = {
- craft = {
- {"technic:solar_array_lv", "technic:solar_array_lv", "technic:solar_array_lv"},
- {"technic:carbon_steel_ingot", "technic:mv_transformer", "technic:carbon_steel_ingot"},
- {"", "technic:mv_cable", ""}
- }
- },
- ["technic:mv_transformer"] = {
- craft = {
- {"mesecons_materials:fiber", "technic:carbon_steel_ingot", "mesecons_materials:fiber"},
- {"technic:copper_coil", "technic:carbon_steel_ingot", "technic:copper_coil"},
- {"technic:carbon_steel_ingot", "technic:carbon_steel_ingot", "technic:carbon_steel_ingot"}
- }
- },
- }
-
- local items = {
- -- ["technic:mv_centrifuge"] = 31 -- 34 minus 3 I already have
- ["technic:mv_transformer"] = 1
- }
-
- local function get_count(goal, recipe)
- local count = goal / (recipe.produces or 1)
- if count ~= math.floor(count) then
- count = math.floor(count) + 1
- end
- return count
- end
-
- local steps = {}
-
- local active = true
- while active do
- active = false
- for item, count in pairs(items) do
- if recipes[item] then
- active = item
- local current = recipes[item]
- local _count = get_count(count, current)
- if current.craft then
- table.insert(steps, "craft "..item.." "..tostring(_count).." times")
- local new = {}
- for y=1,3 do
- for x=1,3 do
- if current.craft[y][x] ~= "" then
- item = current.craft[y][x]
- if new[item] then
- new[item] = new[item] + _count
- else
- new[item] = _count
- end
- end
- end
- end
- for item, count in pairs(new) do
- if items[item] then
- items[item] = items[item] + count
- else
- items[item] = count
- end
- end
- elseif current.compress then
- table.insert(steps, "compress "..item.." "..tostring(_count).." times")
- if current.compress.amount then
- _count = _count * current.compress.amount
- end
- if items[current.compress.item] then
- items[current.compress.item] = items[current.compress.item] + _count
- else
- items[current.compress.item] = _count
- end
- elseif current.alloy then
- table.insert(steps, "alloy "..item.." "..tostring(_count).." times")
- for item, amount in pairs(current.alloy) do
- if items[item] then
- items[item] = items[item] + _count * amount
- else
- items[item] = _count * amount
- end
- end
- elseif current.smelt then
- table.insert(steps, "smelt "..item.." "..tostring(_count).." times")
- if items[current.smelt] then
- items[current.smelt] = items[current.smelt] + _count
- else
- items[current.smelt] = _count
- end
- elseif current.extract then
- table.insert(steps, "extract "..item.." "..tostring(_count).." times")
- if current.extract.amount then
- _count = _count * current.extract.amount
- end
- if items[current.extract.item] then
- items[current.extract.item] = items[current.extract.item] + _count
- else
- items[current.extract.item] = _count
- end
- end
- break
- end
- end
- if active then
- items[active] = nil
- end
- end
-
- for k,v in pairs(items) do
- print(k,v)
- end
-
- for i=#steps,1,-1 do
- print(steps[i])
- end
|