Advertisement
Pilgrimager

jfloor

Nov 15th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. y=0
  2.  
  3. function fleeUp()
  4. for i=1,y do
  5. turtle.digUp()
  6. turtle.up()
  7. end
  8. end
  9.  
  10. function moveDown()
  11. if turtle.detectDown() then
  12. turtle.digDown()
  13. end
  14. if turtle.down() then
  15. y=y+1
  16. end
  17. end
  18.  
  19. function floorOne()
  20. local retval = false
  21. local slot = 0
  22. slot = turtle.getSelectedSlot()
  23. if turtle.getItemCount(slot) == 0 then
  24. if slot < 16 then
  25. turtle.select(slot+1)
  26. turtle.placeDown()
  27. retval = true
  28. else
  29. retval = false
  30. end
  31. else
  32. turtle.placeDown()
  33. retval = true
  34. end
  35. return retval
  36. end
  37.  
  38. function moveForward()
  39. if turtle.detect() then
  40. turtle.dig()
  41. end
  42. return turtle.forward()
  43. end
  44.  
  45. turtle.select(1)
  46. while y < 63 do
  47. for i=1,4 do
  48. moveDown()
  49. end
  50. turnRight = true
  51. for i=1,9 do
  52. for j=1,8 do
  53. if not floorOne() then fleeUp(); shell.exit() end
  54. moveForward()
  55. end
  56. if not floorOne() then fleeUp(); shell.exit() end
  57. if i==9 then
  58. turtle.turnRight()
  59. turtle.turnRight()
  60. else
  61. if turnRight then
  62. turtle.turnRight()
  63. moveForward()
  64. turtle.turnRight()
  65. else
  66. turtle.turnLeft()
  67. moveForward()
  68. turtle.turnLeft()
  69. end
  70. end
  71. turnRight = not turnRight
  72. end
  73. end
  74. turtle.select(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement