recipes: add subtype indicator for each recipe

This commit is contained in:
Danny Robson 2019-04-28 09:22:41 +10:00
parent 44ee8eaeee
commit 79df7638a8
42 changed files with 57 additions and 1 deletions

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "circuit_board": 1, "quickwire": 18 }, "input": { "circuit_board": 1, "quickwire": 18 },
"output": { "ai_limiter": 1 }, "output": { "ai_limiter": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component", "item" ],
"input": { "wire": 2 }, "input": { "wire": 2 },
"output": { "cable": 1 }, "output": { "cable": 1 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "caterium_ore": 4 }, "input": { "caterium_ore": 4 },
"output": { "caterium_ingot": 1 }, "output": { "caterium_ingot": 1 },
"machine": "smelter", "machine": "smelter",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "wire": 12, "plastic": 6 }, "input": { "wire": 12, "plastic": 6 },
"output": { "circuit_board": 1 }, "output": { "circuit_board": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "circuit_board": 5, "cable": 12, "plastic": 18, "screw": 60 }, "input": { "circuit_board": 5, "cable": 12, "plastic": 18, "screw": 60 },
"output": { "computer": 1 }, "output": { "computer": 1 },
"machine": "manufacturer", "machine": "manufacturer",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "limestone": 3 }, "input": { "limestone": 3 },
"output": { "concrete": 1 }, "output": { "concrete": 1 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "copper_ore": 1 }, "input": { "copper_ore": 1 },
"output": { "copper_ingot": 1 }, "output": { "copper_ingot": 1 },
"machine": "smelter", "machine": "smelter",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "steel_beam": 4, "concrete": 5 }, "input": { "steel_beam": 4, "concrete": 5 },
"output": { "encased_industrial_beam": 1 }, "output": { "encased_industrial_beam": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "modular_frame": 5, "steel_pipe": 15, "encased_industrial_beam": 5, "screw": 90 }, "input": { "modular_frame": 5, "steel_pipe": 15, "encased_industrial_beam": 5, "screw": 90 },
"output": { "heavy_modular_frame": 1 }, "output": { "heavy_modular_frame": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "quickwire": 40, "cable": 10, "plastic": 6 }, "input": { "quickwire": 40, "cable": 10, "plastic": 6 },
"output": { "high_speed_connector": 1 }, "output": { "high_speed_connector": 1 },
"machine": "manufacturer", "machine": "manufacturer",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_ore": 1 }, "input": { "iron_ore": 1 },
"output": { "iron_ingot": 1 }, "output": { "iron_ingot": 1 },
"machine": "smelter", "machine": "smelter",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_ingot": 2 }, "input": { "iron_ingot": 2 },
"output": { "iron_plate": 1 }, "output": { "iron_plate": 1 },
"crafting_time": 4, "crafting_time": 4,

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_ingot": 1 }, "input": { "iron_ingot": 1 },
"output": { "iron_rod": 1 }, "output": { "iron_rod": 1 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "reinforced_iron_plate": 3, "iron_rod": 3 }, "input": { "reinforced_iron_plate": 3, "iron_rod": 3 },
"output": { "modular_frame": 1 }, "output": { "modular_frame": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "rotor": 2, "stator": 2 }, "input": { "rotor": 2, "stator": 2 },
"output": { "motor": 1 }, "output": { "motor": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "crude_oil": 4 }, "input": { "crude_oil": 4 },
"output": { "plastic": 3 }, "output": { "plastic": 3 },
"machine": "oil_refinery", "machine": "oil_refinery",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "caterium_ingot": 1 }, "input": { "caterium_ingot": 1 },
"output": { "quickwire": 4 }, "output": { "quickwire": 4 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_plate": 4, "screw": 24 }, "input": { "iron_plate": 4, "screw": 24 },
"output": { "reinforced_iron_plate": 1 }, "output": { "reinforced_iron_plate": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_rod": 3, "screw": 22 }, "input": { "iron_rod": 3, "screw": 22 },
"output": { "rotor": 1 }, "output": { "rotor": 1 },
"machine": "smelter", "machine": "smelter",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "crude_oil": 4 }, "input": { "crude_oil": 4 },
"output": { "rubber": 4 }, "output": { "rubber": 4 },
"machine": "oil_refinery", "machine": "oil_refinery",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_rod": 1 }, "input": { "iron_rod": 1 },
"output": { "screw": 6 }, "output": { "screw": 6 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "steel_pipe": 3, "wire": 10 }, "input": { "steel_pipe": 3, "wire": 10 },
"output": { "stator": 1 }, "output": { "stator": 1 },
"machine": "assembler", "machine": "assembler",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "steel_ingot": 3 }, "input": { "steel_ingot": 3 },
"output": { "steel_beam": 1 }, "output": { "steel_beam": 1 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "iron_ore": 3, "coal": 3 }, "input": { "iron_ore": 3, "coal": 3 },
"output": { "steel_ingot": 2 }, "output": { "steel_ingot": 2 },
"machine": "foundry", "machine": "foundry",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "steel_ingot": 1 }, "input": { "steel_ingot": 1 },
"output": { "steel_pipe": 1 }, "output": { "steel_pipe": 1 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "computer": 2, "ai_limiter": 2, "high_speed_connector": 3, "plastic": 21 }, "input": { "computer": 2, "ai_limiter": 2, "high_speed_connector": 3, "plastic": 21 },
"output": { "supercomputer": 1 }, "output": { "supercomputer": 1 },
"machine": "manufacturer", "machine": "manufacturer",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "component" ],
"input": { "copper_ingot": 1 }, "input": { "copper_ingot": 1 },
"output": { "wire": 3 }, "output": { "wire": 3 },
"machine": "constructor", "machine": "constructor",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "modular_frame": 3, "rotor": 4, "cable": 10 }, "input": { "modular_frame": 3, "rotor": 4, "cable": 10 },
"output": { "assembler": 1 }, "output": { "assembler": 1 },
"machine": "_craft_bench", "machine": "_craft_bench",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "reinforced_iron_plate": 3, "cable": 2 }, "input": { "reinforced_iron_plate": 3, "cable": 2 },
"output": { "constructor": 1 }, "output": { "constructor": 1 },
"machine": "_craft_bench", "machine": "_craft_bench",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "heavy_modular_frame": 2, "motor": 2, "cable": 25, "computer": 3 }, "input": { "heavy_modular_frame": 2, "motor": 2, "cable": 25, "computer": 3 },
"output": { "manufacturer": 1 }, "output": { "manufacturer": 1 },
"machine": "_craft_bench", "machine": "_craft_bench",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "portable_miner": 1, "iron_rod": 5, "concrete": 5 }, "input": { "portable_miner": 1, "iron_rod": 5, "concrete": 5 },
"output": { "miner_mk1": 1 }, "output": { "miner_mk1": 1 },
"is": "miner", "is": "miner",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "heavy_modular_frame": 2, "motor": 3, "cable": 10 }, "input": { "heavy_modular_frame": 2, "motor": 3, "cable": 10 },
"output": { "oil_pump": 1 }, "output": { "oil_pump": 1 },
"machine": "_craft_bench", "machine": "_craft_bench",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine", "item" ],
"input": { "iron_plate": 4, "wire": 8, "cable": 4 }, "input": { "iron_plate": 4, "wire": 8, "cable": 4 },
"output": { "portable_miner": 1 }, "output": { "portable_miner": 1 },
"machine": "equipment_workshop", "machine": "equipment_workshop",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "iron_rod": 5, "wire": 8 }, "input": { "iron_rod": 5, "wire": 8 },
"output": { "smelter": 1 }, "output": { "smelter": 1 },
"machine": "_craft_bench", "machine": "_craft_bench",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "machine" ],
"input": { "concrete": 500, "iron_plate": 250, "iron_rod": 400, "wire": 1500 }, "input": { "concrete": 500, "iron_plate": 250, "iron_rod": 400, "wire": 1500 },
"output": { "space_elevator": 1 }, "output": { "space_elevator": 1 },
"machine": "_placement", "machine": "_placement",

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "resource" ],
"input": { }, "input": { },
"output": { "caterium_ore": 1 }, "output": { "caterium_ore": 1 },
"machine": "miner" "machine": "miner"

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "resource" ],
"input": { }, "input": { },
"output": { "coal": 1 }, "output": { "coal": 1 },
"machine": "miner" "machine": "miner"

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "resource" ],
"input": { }, "input": { },
"output": { "copper_ore": 1 }, "output": { "copper_ore": 1 },
"machine": "miner" "machine": "miner"

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "resource" ],
"input": { }, "input": { },
"output": { "crude_oil": 1 }, "output": { "crude_oil": 1 },
"machine": "oil_pump" "machine": "oil_pump"

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "resource" ],
"input": { }, "input": { },
"output": { "iron_ore": 1 }, "output": { "iron_ore": 1 },
"machine": "miner" "machine": "miner"

View File

@ -1,5 +1,6 @@
[ [
{ {
"type": [ "resource" ],
"input": { }, "input": { },
"output": { "limestone": 1 }, "output": { "limestone": 1 },
"machine": "miner", "machine": "miner",

View File

@ -26,6 +26,21 @@ class Cookbook(object):
def all(self): def all(self):
return self.recipes.keys() return self.recipes.keys()
def is_component(self, name):
return 'component' in self.recipes[name]['type']
def components(self):
found = set()
for target, methods in self.recipes.items():
for variation in methods:
for need, _ in variation['input'].items():
if need in found:
continue
found.add(need)
if not self.is_component(need):
continue
yield need
def graph(recipes: dict, targets: Iterable[str]): def graph(recipes: dict, targets: Iterable[str]):
print("digraph G {") print("digraph G {")
@ -71,6 +86,6 @@ if __name__ == '__main__':
if args.target: if args.target:
graph_one(recipes, args.target) graph_one(recipes, args.target)
else: else:
graph_all(recipes) graph(recipes, recipes.components())
main() main()