adamg765

Floor2

Jan 10th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. -- local tArgs = { ... }
  2. -- local length = tonumber(tArgs[1])
  3. -- local width = tonumber(tArgs[2])
  4. local length = 63
  5. local width = 63
  6.  
  7. local function refuel()
  8. if turtle.getFuelLevel() == 0 then
  9. local prev = turtle.getSelectedSlot()
  10. turtle.select(1)
  11. if not turtle.refuel(1) then
  12. print('Need more fuel')
  13. while not turtle.refuel(1) do
  14. sleep(1)
  15. end
  16. end
  17. turtle.select(prev)
  18. end
  19. end
  20. local function advance()
  21. if turtle.getSelectedSlot() == 16 then
  22. print('Need more materials')
  23. local empty = true
  24. while empty do
  25. for n=2, 16, 1 do
  26. if turtle.getItemCount(n) > 1 then
  27. turtle.select(n)
  28. return
  29. end
  30. end
  31. sleep(3)
  32. end
  33. else
  34. turtle.select(turtle.getSelectedSlot() + 1)
  35. end
  36. end
  37. local function placeBlock()
  38. turtle.placeUp()
  39. turtle.forward()
  40. end
  41. local function turnAround(i)
  42. if i%2 == 1 then
  43. turtle.turnRight()
  44. turtle.forward()
  45. turtle.turnRight()
  46. else
  47. turtle.turnLeft()
  48. turtle.forward()
  49. turtle.turnLeft()
  50. end
  51. end
  52. turtle.select(2)
  53.  
  54. for i = 1, length - 1, 1 do
  55. for j = 1, width - 1, 1 do
  56. refuel()
  57. while turtle.getItemCount() < 1 do
  58. advance()
  59. end
  60. placeBlock()
  61. end
  62. turtle.placeUp()
  63. turnAround(i)
  64. end
Add Comment
Please, Sign In to add comment