Advertisement
feedmecookies

Bomber turtle

Jul 15th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1.  
  2. --Face North--
  3.  
  4.  
  5. -- buffer --
  6. sleep(3)
  7. ------------
  8. --define--
  9. x = 0
  10. y = 0
  11. z = 0
  12. tx = 0
  13. ty = 0
  14. tz = 0
  15. height = 200
  16. rotation = 1
  17. ----------
  18.  
  19. --functions--
  20.  
  21. function bomb(inventoryS, Times)
  22.     for i = 0, Times do
  23.     rs.setOutput("bottom",true)
  24.     turtle.placeDown()
  25.     sleep(0.5)
  26.     rs.setOutput("bottom",false)
  27.     sleep(2)
  28.     end
  29. end
  30.  
  31.  
  32.  
  33.  
  34.  
  35. function rotate(w)
  36.     while rotation ~= w do
  37.         rotation = rotation + 1
  38.         turtle.turnRight()
  39.             if rotation == 5 then
  40.                 rotation = 1
  41.             end
  42.     end
  43. end
  44.  
  45. function GoX(cx,gx)
  46.    
  47.     if cx > gx then
  48.         rotate(4)
  49.             for i = cx, gx + 1, -1 do
  50.                 turtle.forward()
  51.                
  52.             end
  53.     elseif cx < gx then
  54.         rotate(2)
  55.             for i = cx, gx - 1 do
  56.                 turtle.forward()
  57.                             end
  58.  
  59.     end
  60.  
  61. end
  62.  
  63. function GoY(cy,gy)
  64.  
  65.     if cy > gy then
  66.      for i = cy, gy - 1, -1 do
  67.          turtle.down()
  68.      end
  69.     elseif cy < gy then
  70.      for i = cy, gy - 1 do
  71.          turtle.up()
  72.      end
  73.     end
  74. end
  75.  
  76. function GoZ(cz,gz)
  77.     if cz > gz then
  78.      rotate(1)
  79.      for i = cz, gz+1, -1 do
  80.       turtle.forward()
  81.      end
  82.     elseif cz < gz then
  83.      rotate(3)
  84.      for i = cz, gz - 1 do
  85.       turtle.forward()
  86.      end
  87.     end
  88. end
  89.  
  90. function Drop()
  91. end
  92. -------------
  93.  
  94. --main--
  95. GoY(y,height)
  96. GoX(x,tx)
  97. GoZ(z,tz)
  98. GoY(height,ty)
  99. bomb(1,10)
  100. GoY(ty,height)
  101. GoX(tx,x)
  102. GoZ(tz,z)
  103. GoY(height,y)
  104. --------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement