Add component recipes and graphviz output

This commit is contained in:
Danny Robson 2019-04-27 13:56:46 +10:00
commit 8cc17d1ce6
28 changed files with 308 additions and 0 deletions

View File

@ -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"
}
]

9
data/recipes/cable.json Normal file
View File

@ -0,0 +1,9 @@
[
{
"input": { "wire": 2 },
"output": { "cable": 1 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 1
}
]

View File

@ -0,0 +1,10 @@
[
{
"input": { "caterium_ore": 4 },
"output": { "caterium_ingot": 1 },
"machine": "smelter",
"crafting_time": 4,
"clicks": 4,
"requires": "caterium_technology"
}
]

View File

@ -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"
}
]

View File

@ -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"
}
]

View File

@ -0,0 +1,10 @@
[
{
"input": { "limestone": 3 },
"output": { "concrete": 1 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 1,
"stage": "establishing"
}
]

View File

@ -0,0 +1,11 @@
[
{
"input": { "copper_ore": 1 },
"output": { "copper_ingot": 1 },
"machine": "smelter",
"crafting_time": 2,
"clicks": 2,
"stack_size": 100,
"stage": "establishing"
}
]

View File

@ -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"
}
]

View File

@ -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"
}
]

View File

@ -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"
}
]

View File

@ -0,0 +1,9 @@
[
{
"input": { "iron_ore": 1 },
"output": { "iron_ingot": 1 },
"machine": "smelter",
"crafting_time": 2,
"clicks": 2
}
]

View File

@ -0,0 +1,8 @@
[
{
"input": { "iron_ingot": 2 },
"output": { "iron_plate": 1 },
"crafting_time": 4,
"clicks": 1
}
]

View File

@ -0,0 +1,9 @@
[
{
"input": { "iron_ingot": 1 },
"output": { "iron_rod": 1 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 1
}
]

View File

@ -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"
}
]

9
data/recipes/motor.json Normal file
View File

@ -0,0 +1,9 @@
[
{
"input": { "rotor": 2, "stator": 2 },
"output": { "motor": 1 },
"machine": "assembler",
"crafting_time": 12,
"clicks": 3
}
]

11
data/recipes/plastic.json Normal file
View File

@ -0,0 +1,11 @@
[
{
"input": { "crude_oil": 4 },
"output": { "plastic": 3 },
"machine": "oil_refinery",
"crafting_time": 8,
"clicks": 2,
"stack_size": 100,
"stage": "expansion"
}
]

View File

@ -0,0 +1,11 @@
[
{
"input": { "caterium_ingot": 1 },
"output": { "quickwire": 4 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 1,
"stack_size": 500,
"requires": "caterium_technology"
}
]

View File

@ -0,0 +1,8 @@
[
{
"input": { "iron_plate": 4, "screw": 24 },
"output": { "reinforced_iron_plate": 1 },
"crafting_time": 12,
"clicks": 3
}
]

11
data/recipes/rotor.json Normal file
View File

@ -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"
}
]

11
data/recipes/rubber.json Normal file
View File

@ -0,0 +1,11 @@
[
{
"input": { "crude_oil": 4 },
"output": { "rubber": 4 },
"machine": "oil_refinery",
"crafting_time": 8,
"clicks": 2,
"stack_size": 100,
"stage": "expansion"
}
]

9
data/recipes/screw.json Normal file
View File

@ -0,0 +1,9 @@
[
{
"input": { "iron_rod": 1 },
"output": { "screw": 6 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 2
}
]

9
data/recipes/stator.json Normal file
View File

@ -0,0 +1,9 @@
[
{
"input": { "steel_pipe": 3, "wire": 10 },
"output": { "stator": 1 },
"machine": "assembler",
"crafting_time": 10,
"clicks": 3
}
]

View File

@ -0,0 +1,10 @@
[
{
"input": { "steel_ingot": 3 },
"output": { "steel_beam": 1 },
"machine": "constructor",
"crafting_time": 6,
"clicks": 2,
"stack_size": 100
}
]

View File

@ -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"
}
]

View File

@ -0,0 +1,11 @@
[
{
"input": { "steel_ingot": 1 },
"output": { "steel_pipe": 1 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 1,
"stack_size": 100,
"stage": "development"
}
]

View File

@ -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"
}
]

11
data/recipes/wire.json Normal file
View File

@ -0,0 +1,11 @@
[
{
"input": { "copper_ingot": 1 },
"output": { "wire": 3 },
"machine": "constructor",
"crafting_time": 4,
"clicks": 1,
"stack_size": 500,
"stage": "establishing"
}
]

32
required.py Executable file
View File

@ -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)