Advertisement
Guest User

bridgeDown

a guest
Mar 23rd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. function reboot()
  2.     if turtle.getItemCount() <1 then
  3.         shell.run("reboot")
  4.     end
  5. end
  6.  
  7. function fuel()
  8.     while turtle.getFuelLevel() <100 do
  9.         for i=1,16 do
  10.             turtle.select(i)
  11.             turtle.refuel(2)
  12.         end
  13.         break
  14.     end
  15. end
  16.  
  17. function forward()
  18.     turtle.forward()
  19. end
  20.  
  21. function placeDown()
  22.     while not turtle.detectDown() do
  23.         turtle.select(1)
  24.         turtle.placeDown()
  25.     end
  26. end
  27.  
  28. function shutdown()
  29.     if turtle.getItemCount(1) <1 then
  30.         shell.run("reboot")
  31.     end
  32. end
  33.  
  34. function bridge(s)
  35.     fuel(1)
  36.     for i=1,s,1 do
  37. --        forward(1)
  38.         placeDown(1)
  39.         forward(1)
  40.         reboot(1)
  41.     end
  42. end
  43.  
  44. local tArgs = {...}
  45.  
  46. function down()
  47.     turtle.down()
  48. end
  49.  
  50. function moveForwardDown(s)
  51.     for i=1,s,1 do
  52.         forward(1)
  53.         down(1)
  54.     end
  55. end
  56.  
  57. function moveForwardDownPlaceDown(s)
  58.     for i=1,s,1 do
  59.         moveForwardDown(1)
  60.         placeDown(1)
  61.     end
  62. end
  63.  
  64. function moveForwardDownPlaceDownMoveForward(s)
  65.     for i=1,s,1 do
  66.         moveForwardDownPlaceDown(1)
  67.         forward(1)
  68.     end
  69. end
  70.  
  71. function back()
  72.     turtle.back()
  73. end
  74.  
  75. function bridgeDown(s)
  76.     for i=1,s,1 do
  77.         bridge(tArgs[1])
  78.         back(1)
  79.         moveForwardDownPlaceDown(tArgs[2])
  80.     end
  81. end
  82.  
  83. bridgeDown(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement