Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. local payload = 3
  2. local distance = 33
  3. local height = 3
  4.  
  5.  
  6.  
  7.  
  8. --Bombs must be in slot 2
  9.  
  10. -- Function Declaration ============================
  11. -- drop bombs function
  12. function dropBomb()
  13. for i=0, payload do
  14. if turtle.getFuelLevel()<1 then
  15. turtle.refuel()
  16. end
  17.  
  18. turtle.select(2)
  19. redstone.setOutput("bottom",true)
  20. turtle.placeDown()
  21. for n=0,3 do
  22. turtle.forward(3)
  23. end
  24. end
  25. end
  26. -- end drop bombs
  27.  
  28. -- take off function
  29.  
  30. function takeOff()
  31. for q=0,height do
  32. if turtle.getFuelLevel()<1 then
  33. turtle.refuel()
  34. end
  35. turtle.up()
  36. end
  37. end
  38.  
  39. -- end take off
  40.  
  41. -- move forward function
  42. function moveForward()
  43. for w=0,distance do
  44. -- check fuel
  45. if turtle.getFuelLevel()<1 then
  46. turtle.refuel()
  47. end
  48. -- end check fuel
  49.  
  50. -- move if not in turning phase
  51.  
  52. turtle.forward()
  53.  
  54. -- end movement
  55.  
  56. end
  57. end
  58. -- end move forward
  59.  
  60.  
  61. -- spin function
  62. function spin()
  63. turtle.turnRight()
  64. -- because turnRight(2) doesn't work
  65. turtle.turnRight()
  66.  
  67. print("turned around")
  68. end
  69. -- end spin function
  70.  
  71.  
  72.  
  73.  
  74. -- land function
  75.  
  76. function land()
  77. for t=0,height do
  78. -- check fuel
  79. if turtle.getFuelLevel()<1 then
  80. turtle.refuel()
  81. end
  82. turtle.down()
  83. end
  84. spin()
  85. print("Bombing run complete")
  86. print("distance:") print (distance)
  87. print("height:") print (height)
  88. print("payload:") print (payload)
  89. end
  90.  
  91. -- end land function
  92.  
  93. -- End Of Function Declaration ============================
  94.  
  95. -- Execution
  96.  
  97. takeOff()
  98. moveForward()
  99. dropBomb()
  100. spin()
  101. dropBomb()
  102. moveForward()
  103. land()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement