Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local payload = 3
- local distance = 33
- local height = 3
- --Bombs must be in slot 2
- -- Function Declaration ============================
- -- drop bombs function
- function dropBomb()
- for i=0, payload do
- if turtle.getFuelLevel()<1 then
- turtle.refuel()
- end
- turtle.select(2)
- redstone.setOutput("bottom",true)
- turtle.placeDown()
- for n=0,3 do
- turtle.forward(3)
- end
- end
- end
- -- end drop bombs
- -- take off function
- function takeOff()
- for q=0,height do
- if turtle.getFuelLevel()<1 then
- turtle.refuel()
- end
- turtle.up()
- end
- end
- -- end take off
- -- move forward function
- function moveForward()
- for w=0,distance do
- -- check fuel
- if turtle.getFuelLevel()<1 then
- turtle.refuel()
- end
- -- end check fuel
- -- move if not in turning phase
- turtle.forward()
- -- end movement
- end
- end
- -- end move forward
- -- spin function
- function spin()
- turtle.turnRight()
- -- because turnRight(2) doesn't work
- turtle.turnRight()
- print("turned around")
- end
- -- end spin function
- -- land function
- function land()
- for t=0,height do
- -- check fuel
- if turtle.getFuelLevel()<1 then
- turtle.refuel()
- end
- turtle.down()
- end
- spin()
- print("Bombing run complete")
- print("distance:") print (distance)
- print("height:") print (height)
- print("payload:") print (payload)
- end
- -- end land function
- -- End Of Function Declaration ============================
- -- Execution
- takeOff()
- moveForward()
- dropBomb()
- spin()
- dropBomb()
- moveForward()
- land()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement