Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = { ... }
- function forward()
- while (true) do
- if(not(turtle.detect())) then
- turtle.attack()
- turtle.forward()
- return
- end
- turtle.attackUp()
- turtle.digUp()
- turtle.up()
- end
- end
- function checkBlockToCut()
- for i=1,args[2] do
- turtle.select(i)
- if(turtle.compareDown() or not(turtle.detectDown())) then
- return true
- end
- end
- return false
- end
- function cut()
- local downSteps = 0
- while(checkBlockToCut()) do
- turtle.attackDown()
- turtle.digDown()
- turtle.down()
- -- downSteps = downSteps + 1
- end
- -- for i=1,downSteps do
- -- turtle.up()
- -- end
- end
- function run()
- while (true) do
- turtle.turnRight()
- for i=1,args[1]-1 do
- cut()
- forward()
- end
- cut()
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- for i=1,args[1]-1 do
- cut()
- forward()
- end
- cut()
- turtle.turnRight()
- forward()
- end
- end
- function init()
- if (#args ~= 2) then
- print("Usage: cutter [cutter width] [blocks to cut]")
- os.exit()
- end
- -- cutterWidth = args[1]
- -- blocksToCut = args[0]
- end
- function main()
- init()
- run()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement