From 8cc17d1ce6694d335c343405e24cb479804af016 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 27 Apr 2019 13:56:46 +1000 Subject: [PATCH] Add component recipes and graphviz output --- data/recipes/ai_limiter.json | 11 ++++++++ data/recipes/cable.json | 9 +++++++ data/recipes/caterium_ingot.json | 10 +++++++ data/recipes/circuit_board.json | 11 ++++++++ data/recipes/computer.json | 11 ++++++++ data/recipes/concrete.json | 10 +++++++ data/recipes/copper_ingot.json | 11 ++++++++ data/recipes/encased_industrial_beam.json | 11 ++++++++ data/recipes/heavy_modular_frame.json | 11 ++++++++ data/recipes/high_speed_connector.json | 11 ++++++++ data/recipes/iron_ingot.json | 9 +++++++ data/recipes/iron_plate.json | 8 ++++++ data/recipes/iron_rod.json | 9 +++++++ data/recipes/modular_frame.json | 11 ++++++++ data/recipes/motor.json | 9 +++++++ data/recipes/plastic.json | 11 ++++++++ data/recipes/quickwire.json | 11 ++++++++ data/recipes/reinforced_iron_plate.json | 8 ++++++ data/recipes/rotor.json | 11 ++++++++ data/recipes/rubber.json | 11 ++++++++ data/recipes/screw.json | 9 +++++++ data/recipes/stator.json | 9 +++++++ data/recipes/steel_beam.json | 10 +++++++ data/recipes/steel_ingot.json | 11 ++++++++ data/recipes/steel_pipe.json | 11 ++++++++ data/recipes/supercomputer.json | 11 ++++++++ data/recipes/wire.json | 11 ++++++++ required.py | 32 +++++++++++++++++++++++ 28 files changed, 308 insertions(+) create mode 100644 data/recipes/ai_limiter.json create mode 100644 data/recipes/cable.json create mode 100644 data/recipes/caterium_ingot.json create mode 100644 data/recipes/circuit_board.json create mode 100644 data/recipes/computer.json create mode 100644 data/recipes/concrete.json create mode 100644 data/recipes/copper_ingot.json create mode 100644 data/recipes/encased_industrial_beam.json create mode 100644 data/recipes/heavy_modular_frame.json create mode 100644 data/recipes/high_speed_connector.json create mode 100644 data/recipes/iron_ingot.json create mode 100644 data/recipes/iron_plate.json create mode 100644 data/recipes/iron_rod.json create mode 100644 data/recipes/modular_frame.json create mode 100644 data/recipes/motor.json create mode 100644 data/recipes/plastic.json create mode 100644 data/recipes/quickwire.json create mode 100644 data/recipes/reinforced_iron_plate.json create mode 100644 data/recipes/rotor.json create mode 100644 data/recipes/rubber.json create mode 100644 data/recipes/screw.json create mode 100644 data/recipes/stator.json create mode 100644 data/recipes/steel_beam.json create mode 100644 data/recipes/steel_ingot.json create mode 100644 data/recipes/steel_pipe.json create mode 100644 data/recipes/supercomputer.json create mode 100644 data/recipes/wire.json create mode 100755 required.py diff --git a/data/recipes/ai_limiter.json b/data/recipes/ai_limiter.json new file mode 100644 index 0000000..21036d1 --- /dev/null +++ b/data/recipes/ai_limiter.json @@ -0,0 +1,11 @@ +[ + { + "input": { "circuit_board": 1, "quickwire": 18 }, + "output": { "ai_limiter": 1 }, + "machine": "assembler", + "crafting_time": 12, + "clicks": 3, + "stack_size": 100, + "requires": "caterium_electronics" + } +] diff --git a/data/recipes/cable.json b/data/recipes/cable.json new file mode 100644 index 0000000..56f7a1a --- /dev/null +++ b/data/recipes/cable.json @@ -0,0 +1,9 @@ +[ + { + "input": { "wire": 2 }, + "output": { "cable": 1 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 1 + } +] diff --git a/data/recipes/caterium_ingot.json b/data/recipes/caterium_ingot.json new file mode 100644 index 0000000..2d0970f --- /dev/null +++ b/data/recipes/caterium_ingot.json @@ -0,0 +1,10 @@ +[ + { + "input": { "caterium_ore": 4 }, + "output": { "caterium_ingot": 1 }, + "machine": "smelter", + "crafting_time": 4, + "clicks": 4, + "requires": "caterium_technology" + } +] diff --git a/data/recipes/circuit_board.json b/data/recipes/circuit_board.json new file mode 100644 index 0000000..fe5adb1 --- /dev/null +++ b/data/recipes/circuit_board.json @@ -0,0 +1,11 @@ +[ + { + "input": { "wire": 12, "plastic": 6 }, + "output": { "circuit_board": 1 }, + "machine": "assembler", + "crafting_time": 12, + "clicks": 3, + "stack_size": 100, + "stage": "expansion" + } +] diff --git a/data/recipes/computer.json b/data/recipes/computer.json new file mode 100644 index 0000000..ba03443 --- /dev/null +++ b/data/recipes/computer.json @@ -0,0 +1,11 @@ +[ + { + "input": { "circuit_board": 5, "cable": 12, "plastic": 18, "screw": 60 }, + "output": { "computer": 1 }, + "machine": "manufacturer", + "crafting_time": 32, + "clicks": 8, + "stack_size": 50, + "stage": "expansion" + } +] diff --git a/data/recipes/concrete.json b/data/recipes/concrete.json new file mode 100644 index 0000000..926b36c --- /dev/null +++ b/data/recipes/concrete.json @@ -0,0 +1,10 @@ +[ + { + "input": { "limestone": 3 }, + "output": { "concrete": 1 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 1, + "stage": "establishing" + } +] diff --git a/data/recipes/copper_ingot.json b/data/recipes/copper_ingot.json new file mode 100644 index 0000000..121e1a3 --- /dev/null +++ b/data/recipes/copper_ingot.json @@ -0,0 +1,11 @@ +[ + { + "input": { "copper_ore": 1 }, + "output": { "copper_ingot": 1 }, + "machine": "smelter", + "crafting_time": 2, + "clicks": 2, + "stack_size": 100, + "stage": "establishing" + } +] \ No newline at end of file diff --git a/data/recipes/encased_industrial_beam.json b/data/recipes/encased_industrial_beam.json new file mode 100644 index 0000000..e03c8ae --- /dev/null +++ b/data/recipes/encased_industrial_beam.json @@ -0,0 +1,11 @@ +[ + { + "input": { "steel_beam": 4, "concrete": 5 }, + "output": { "encased_industrial_beam": 1 }, + "machine": "assembler", + "crafting_time": 15, + "clicks": 4, + "stack_size": 100, + "stage": "development" + } +] diff --git a/data/recipes/heavy_modular_frame.json b/data/recipes/heavy_modular_frame.json new file mode 100644 index 0000000..8cc789c --- /dev/null +++ b/data/recipes/heavy_modular_frame.json @@ -0,0 +1,11 @@ +[ + { + "input": { "modular_frame": 5, "steel_pipe": 15, "encased_industrial_beam": 5, "screw": 90 }, + "output": { "heavy_modular_frame": 1 }, + "machine": "assembler", + "crafting_time": 30, + "clicks": 8, + "stack_size": 50, + "stage": "development" + } +] diff --git a/data/recipes/high_speed_connector.json b/data/recipes/high_speed_connector.json new file mode 100644 index 0000000..193d35f --- /dev/null +++ b/data/recipes/high_speed_connector.json @@ -0,0 +1,11 @@ +[ + { + "input": { "quickwire": 40, "cable": 10, "plastic": 6 }, + "output": { "high_speed_connector": 1 }, + "machine": "manufacturer", + "crafting_time": 24, + "clicks": 6, + "stack_size": 100, + "requires": "caterium_electronics" + } +] diff --git a/data/recipes/iron_ingot.json b/data/recipes/iron_ingot.json new file mode 100644 index 0000000..61d747d --- /dev/null +++ b/data/recipes/iron_ingot.json @@ -0,0 +1,9 @@ +[ + { + "input": { "iron_ore": 1 }, + "output": { "iron_ingot": 1 }, + "machine": "smelter", + "crafting_time": 2, + "clicks": 2 + } +] diff --git a/data/recipes/iron_plate.json b/data/recipes/iron_plate.json new file mode 100644 index 0000000..597a914 --- /dev/null +++ b/data/recipes/iron_plate.json @@ -0,0 +1,8 @@ +[ + { + "input": { "iron_ingot": 2 }, + "output": { "iron_plate": 1 }, + "crafting_time": 4, + "clicks": 1 + } +] diff --git a/data/recipes/iron_rod.json b/data/recipes/iron_rod.json new file mode 100644 index 0000000..a90c571 --- /dev/null +++ b/data/recipes/iron_rod.json @@ -0,0 +1,9 @@ +[ + { + "input": { "iron_ingot": 1 }, + "output": { "iron_rod": 1 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 1 + } +] \ No newline at end of file diff --git a/data/recipes/modular_frame.json b/data/recipes/modular_frame.json new file mode 100644 index 0000000..bb842c2 --- /dev/null +++ b/data/recipes/modular_frame.json @@ -0,0 +1,11 @@ +[ + { + "input": { "reinforced_iron_plate": 3, "rod": 3 }, + "output": { "modular_frame": 1 }, + "machine": "assembler", + "crafting_time": 15, + "clicks": 4, + "stack_size": 50, + "stage": "establishing" + } +] diff --git a/data/recipes/motor.json b/data/recipes/motor.json new file mode 100644 index 0000000..3aa15fa --- /dev/null +++ b/data/recipes/motor.json @@ -0,0 +1,9 @@ +[ + { + "input": { "rotor": 2, "stator": 2 }, + "output": { "motor": 1 }, + "machine": "assembler", + "crafting_time": 12, + "clicks": 3 + } +] diff --git a/data/recipes/plastic.json b/data/recipes/plastic.json new file mode 100644 index 0000000..2a0e62d --- /dev/null +++ b/data/recipes/plastic.json @@ -0,0 +1,11 @@ +[ + { + "input": { "crude_oil": 4 }, + "output": { "plastic": 3 }, + "machine": "oil_refinery", + "crafting_time": 8, + "clicks": 2, + "stack_size": 100, + "stage": "expansion" + } +] diff --git a/data/recipes/quickwire.json b/data/recipes/quickwire.json new file mode 100644 index 0000000..dc56f42 --- /dev/null +++ b/data/recipes/quickwire.json @@ -0,0 +1,11 @@ +[ + { + "input": { "caterium_ingot": 1 }, + "output": { "quickwire": 4 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 1, + "stack_size": 500, + "requires": "caterium_technology" + } +] diff --git a/data/recipes/reinforced_iron_plate.json b/data/recipes/reinforced_iron_plate.json new file mode 100644 index 0000000..3da1632 --- /dev/null +++ b/data/recipes/reinforced_iron_plate.json @@ -0,0 +1,8 @@ +[ + { + "input": { "iron_plate": 4, "screw": 24 }, + "output": { "reinforced_iron_plate": 1 }, + "crafting_time": 12, + "clicks": 3 + } +] diff --git a/data/recipes/rotor.json b/data/recipes/rotor.json new file mode 100644 index 0000000..7ca836a --- /dev/null +++ b/data/recipes/rotor.json @@ -0,0 +1,11 @@ +[ + { + "input": { "iron_rod": 3, "screw": 22 }, + "output": { "rotor": 1 }, + "machine": "smelter", + "crafting_time": 10, + "clicks": 3, + "stack_size": 100, + "stage": "establishing" + } +] diff --git a/data/recipes/rubber.json b/data/recipes/rubber.json new file mode 100644 index 0000000..1916887 --- /dev/null +++ b/data/recipes/rubber.json @@ -0,0 +1,11 @@ +[ + { + "input": { "crude_oil": 4 }, + "output": { "rubber": 4 }, + "machine": "oil_refinery", + "crafting_time": 8, + "clicks": 2, + "stack_size": 100, + "stage": "expansion" + } +] diff --git a/data/recipes/screw.json b/data/recipes/screw.json new file mode 100644 index 0000000..0e416d7 --- /dev/null +++ b/data/recipes/screw.json @@ -0,0 +1,9 @@ +[ + { + "input": { "iron_rod": 1 }, + "output": { "screw": 6 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 2 + } +] diff --git a/data/recipes/stator.json b/data/recipes/stator.json new file mode 100644 index 0000000..0108c6a --- /dev/null +++ b/data/recipes/stator.json @@ -0,0 +1,9 @@ +[ + { + "input": { "steel_pipe": 3, "wire": 10 }, + "output": { "stator": 1 }, + "machine": "assembler", + "crafting_time": 10, + "clicks": 3 + } +] \ No newline at end of file diff --git a/data/recipes/steel_beam.json b/data/recipes/steel_beam.json new file mode 100644 index 0000000..551e9e4 --- /dev/null +++ b/data/recipes/steel_beam.json @@ -0,0 +1,10 @@ +[ + { + "input": { "steel_ingot": 3 }, + "output": { "steel_beam": 1 }, + "machine": "constructor", + "crafting_time": 6, + "clicks": 2, + "stack_size": 100 + } +] diff --git a/data/recipes/steel_ingot.json b/data/recipes/steel_ingot.json new file mode 100644 index 0000000..6304a60 --- /dev/null +++ b/data/recipes/steel_ingot.json @@ -0,0 +1,11 @@ +[ + { + "input": { "iron_ore": 3, "coal": 3 }, + "output": { "steel_ingot": 2 }, + "machine": "foundry", + "crafting_time": 4, + "clicks": 4, + "stack_size": 100, + "stage": "development" + } +] diff --git a/data/recipes/steel_pipe.json b/data/recipes/steel_pipe.json new file mode 100644 index 0000000..58aabc7 --- /dev/null +++ b/data/recipes/steel_pipe.json @@ -0,0 +1,11 @@ +[ + { + "input": { "steel_ingot": 1 }, + "output": { "steel_pipe": 1 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 1, + "stack_size": 100, + "stage": "development" + } +] diff --git a/data/recipes/supercomputer.json b/data/recipes/supercomputer.json new file mode 100644 index 0000000..8e7dff4 --- /dev/null +++ b/data/recipes/supercomputer.json @@ -0,0 +1,11 @@ +[ + { + "input": { "computer": 2, "ai_limiter": 2, "high_speed_connector": 3, "plastic": 21 }, + "output": { "supercomputer": 1 }, + "machine": "manufacturer", + "crafting_time": 32, + "clicks": 8, + "stack_size": 50, + "requires": "advanced_caterium_electronics" + } +] diff --git a/data/recipes/wire.json b/data/recipes/wire.json new file mode 100644 index 0000000..9f410b6 --- /dev/null +++ b/data/recipes/wire.json @@ -0,0 +1,11 @@ +[ + { + "input": { "copper_ingot": 1 }, + "output": { "wire": 3 }, + "machine": "constructor", + "crafting_time": 4, + "clicks": 1, + "stack_size": 500, + "stage": "establishing" + } +] diff --git a/required.py b/required.py new file mode 100755 index 0000000..00a0a93 --- /dev/null +++ b/required.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import json +import typing +import os + + +def as_graphviz(recipes: dict): + print("digraph G {") + for result, method in recipes.items(): + for variation in method: + for input in variation["input"]: + print(f"{input} -> {result}") + print("}") + + +if __name__ == '__main__': + root = os.path.dirname(__file__) + recipe_root = os.path.join(root, 'data', 'recipes') + + recipes = dict() + + for dirname, dirs, files in os.walk(recipe_root): + for f in files: + path = os.path.join(dirname, f) + name, _ = os.path.splitext(f) + with open(path, 'r') as src: + variations = json.load(src) + + recipes[name] = variations + + as_graphviz(recipes)