Sivarias

CC_turtle_!floor

Oct 17th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. --!floor
  2. --This simply lays down a floor of a specified area Nothing more
  3. print("I start counting the blocks in front of me!")
  4. print("How far forward boss?")
  5. local x=tonumber(read())-1
  6. print("How far across boss?")
  7. local y=tonumber(read())
  8. print("Left or Right boss? (L/R)")
  9. local dir=read()
  10. if dir=="L" or dir=="l" then
  11. dir="L"
  12. elseif dir=="R" or dir=="r" then
  13. dir="R"
  14. end
  15. a=1
  16. t.forward()
  17. if not turtle.detectDown() then
  18. turtle.select(a)
  19. turtle.placeDown()
  20. end
  21. if x*y+1<=turtle.getFuelLevel() then
  22. for j=1, y do
  23. for i=1, x do
  24. if turtle.getItemCount(a)==0 then
  25. a=a+1
  26. end
  27. t.forward()
  28. if not turtle.detectDown() then
  29. turtle.select(a)
  30. turtle.placeDown()
  31. end
  32. end
  33. if turtle.getItemCount(a)==0 then
  34. a=a+1
  35. end
  36. if dir=="R" then
  37. t.right()
  38. t.forward()
  39. if not turtle.detectDown() then
  40. turtle.select(a)
  41. if j~=y then
  42. turtle.placeDown()
  43. end
  44. end
  45. t.right()
  46. dir="L"
  47. elseif dir=="L" then
  48. t.left()
  49. t.forward()
  50. if not turtle.detectDown() then
  51. turtle.select(a)
  52. if j~=y then
  53. turtle.placeDown()
  54. end
  55. end
  56. t.left()
  57. dir="R"
  58. end
  59. end
  60. else
  61. print("Not enough fuel boss! Try again later!")
  62. end
Advertisement
Add Comment
Please, Sign In to add comment