Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local fs = require("filesystem")
- local json = require("json")
- local r = component.robot
- local ic = component.inventory_controller
- local craft = component.crafting
- local databaseFile = "/home/recipes.db"
- local db = fs.open(databaseFile,"r")
- local jsonRaw = db:read(fs.size(databaseFile))
- local recipes = json.decode(jsonRaw)
- local slots = {1,2,3,5,6,7,9,10,11}
- local chestSide = 4
- local recipe = {}
- local target = "5"
- for i=1,9 do
- table.insert(recipe,recipes[target]["r"][i..""])
- end
- for k,v in pairs(recipe) do
- print(k..": "..v)
- end
- for i=1,9 do
- r.select(slots[i])
- findItem(recipe[i])
- end
- r.select(4)
- craft.craft()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement