Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local file = fs.open("RecipeList/"..tArgs[1].."/path1","r")
- local data = file.readAll()
- file.close()
- local path1 = textutils.unserialize(data)
- local item = nil
- local amount = 0
- local count = 0
- for i,v in pairs(path1) do
- count = count + 1
- end
- print(data)
- local craftingGrid = {1,2,3,5,6,7,9,10,11}
- function clearInv(n,p)
- local s = 1
- if p == nil then
- p = 1
- elseif math.abs(p)~=p then
- s = n
- n = 1
- end
- for i=s,n,p do
- turtle.select(i)
- turtle.dropDown()
- end
- end
- function buffer()
- turtle.select(16)
- while amount~=count and turtle.suck() do
- item = turtle.getItemDetail()
- for i,v in pairs(path1) do
- if v == item.name then
- if turtle.transferTo(i,1) then
- amount = amount + 1
- end
- end
- end
- if turtle.getItemCount() > 0 then
- turtle.dropDown()
- end
- end
- end
- function craft()
- if not turtle.craft() then
- textutils.slowPrint("Error: Insufficient Ingredients")
- clearInv(15,-1)
- error()
- else
- if turtle.getSelectedSlot() ~= 16 then
- turtle.select(16)
- end
- turtle.dropUp()
- clearInv(15,-1)
- end
- end
- function run()
- buffer()
- craft()
- end
- buffer()
- craft()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement