Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local t = turtle
- local error = 0
- function rotateBlock()
- rs.setOutput("left",true)
- sleep(0.1)
- rs.setOutput("left",false)
- os.pullEvent("redstone")
- if(not rs.getInput("left")) then
- print("Warning: wrong redstone signal received")
- local signal = false
- while not signal do
- os.pullEvent("redstone")
- signal = rs.getInput("left")
- end
- print("Warning: correct redstone signal received after wrong signal")
- end
- end
- function openDoor()
- t.select(2)
- if(t.getItemCount(2) > 0) then
- print("Error: ItemCount slot 2 > 0")
- error = 11
- return
- end
- rs.setOutput("top",true)
- sleep(0.05)
- rs.setOutput("top",false)
- if(t.getItemCount(2) == 0) then
- print("Error: ItemCount slot 2 == 0")
- error = 12
- return
- end
- if(not t.transferTo(3)) then
- print("Error: transfer to slot 3 failed")
- error = 13
- return
- end
- if(not t.digUp()) then
- print("Error: cannot break Block Breaker")
- error = 21
- return
- end
- t.select(1)
- if(not t.placeUp()) then
- print("Error: cannot place Auto Placer")
- error = 22
- return
- end
- if(t.getItemCount(1) < 1) then
- print("Error: less than one Auto Placer remaining")
- error = 14
- return
- end
- rotateBlock()
- t.select(3)
- if(t.getItemCount(3) < 3) then
- print("Error: less than three door blocks in slot 3")
- error = 15
- return
- end
- if(not t.dropUp(2)) then
- print("Error: cannot drop two items into Auto Placer")
- error = 31
- return
- end
- end
- function closeDoor()
- t.select(3)
- if(t.getItemCount(3) < 1) then
- print("Error: less than one door block(s) in slot 3")
- error = 16
- return
- end
- if(not t.dropUp()) then
- print("Error: cannot drop items into Auto Placer")
- error = 32
- return
- end
- t.select(1)
- local nPlacers = t.getItemCount(1)
- if(not t.digUp()) then
- print("Error: cannot break Auto Placer")
- error = 23
- return
- end
- if(t.getItemCount(1) ~= nPlacers + 1) then
- print("Error: inventory mix up; nPlacers = "..nPlacers)
- error = 17
- return
- end
- t.select(2)
- if(not t.placeUp()) then
- print("Error: cannot place Block Breaker")
- error = 24
- return
- end
- rotateBlock()
- end
- function consistencyCheck()
- end
Advertisement
Add Comment
Please, Sign In to add comment