Advertisement
nstjlol

Untitled

Oct 20th, 2021
677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. goLeft = false
  2. coalSlots = {1,5,9,13}
  3. iFuel = 1
  4. brickSlots = {2,3,4,6,7,8,10,11,12,14,15,16}
  5. iBrick = 1
  6. print("Enter L or R")
  7. direction = read()
  8. if direction == "l" then
  9.     goLeft = true
  10. end
  11. print("Enter x:")
  12. x = tonumber(read())
  13. print("Enter y:")
  14. y = tonumber(read()) - 1
  15. yT = y
  16.  
  17. function refuelT ()
  18.     turtle.select(coalSlots[iFuel])
  19.     turtle.refuel()
  20.     iFuel = iFuel + 1
  21. end
  22.  
  23. function selectBrick ()
  24.    turtle.select(brickSlots[iBrick])
  25.    if iBrick < 12 then
  26.        iBrick = iBrick + 1
  27.    else
  28.        iBrick = 1
  29.    end
  30. end
  31.  
  32. refuelT()
  33. selectBrick()
  34. while x >= 1 do
  35.     y = yT
  36.     while y >= 1 do
  37.         print("x: " .. x .. ", y: ".. y)
  38.         turtle.digDown()
  39.         if turtle.getItemCount() == 1 then
  40.             selectBrick()
  41.         end
  42.         turtle.placeDown()
  43.         turtle.digUp()
  44.         turtle.dig()
  45.         while turtle.detect() == true do
  46.             turtle.dig()
  47.             sleep(0.5)
  48.         end
  49.         turtle.forward()
  50.         y = y - 1
  51.     end
  52.     print(x)
  53.     if goLeft == true then
  54.         turtle.digUp()
  55.         turtle.digDown()
  56.         if turtle.getItemCount() == 1 then
  57.             selectBrick()
  58.         end
  59.         turtle.placeDown()
  60.         turtle.turnLeft()
  61.         turtle.dig()
  62.         while turtle.detect() == true do
  63.             turtle.dig()
  64.             sleep(0.5)
  65.         end
  66.         turtle.forward()
  67.         turtle.digUp()
  68.         turtle.turnLeft()
  69.         goLeft = false
  70.     else
  71.         turtle.digUp()
  72.         turtle.digDown()
  73.         if turtle.getItemCount() == 1 then
  74.             selectBrick()
  75.         end
  76.         turtle.placeDown()
  77.         turtle.turnRight()
  78.         turtle.dig()
  79.         while turtle.detect() == true do
  80.             turtle.dig()
  81.             sleep(0.5)
  82.         end
  83.         turtle.forward()
  84.         turtle.digUp()
  85.         turtle.turnRight()
  86.         goLeft = true
  87.     end
  88.     x = x - 1
  89. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement