Advertisement
Guest User

bridgeStraight

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