Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ***********
- * event
- *
- **********
- ]]
- -- get arguments.
- --define functions.
- function dig(dir)
- local currentDig = turtle.dig
- local currentDetect = turtle.detect
- if dir == 'up' then
- currentDig = turtle.digUp
- currentDetect = turtle.detectUp
- elseif dir == 'down' then
- currentDig = turtle.digDown
- currentDetect = turtle.detectDown
- end
- local times = 0
- while currentDetect() do
- currentDig()
- times = times + 1
- if times == 15 then
- print("cant' dig!")
- exit() -- dare to cause error.
- break
- end
- sleep(1)
- end
- end
- function move(dir)
- local currentAttack = turtle.attack
- local currentMove = turtle.forward
- if dir == 'up' then
- currentAttack = turtle.attackUp
- currentMove = turtle.up
- elseif dir == 'down' then
- currentAttack = turtle.attackDown
- currentMove = turtle.down
- end
- local times = 0
- while currentMove() == false do
- currentAttack()
- times = times + 1
- if times == 30 then
- print("Can't move!")
- exit() -- dare to cause error.
- end
- end
- end
- function digSt(dist)
- for i=1, dist, 1 do
- dig('up')
- dig('down')
- turtle.turnLeft()
- dig('front')
- turtle.turnRight()
- turtle.turnRight()
- dig('front')
- turtle.turnLeft()
- dig('front')
- move('front')
- end
- end
- function digE(dir, dist)
- for i=1, dist, 1 do
- dig('front')
- turtle.turnLeft()
- dig('front')
- turtle.turnLeft()
- dig('front')
- turtle.turnLeft()
- dig('front')
- turtle.turnLeft()
- dig(dir)
- move(dir)
- end
- end
- function dropStone()
- for i=2, 16, 1 do
- turtle.select(i)
- if turtle.compareTo(1) then
- turtle.drop()
- end
- end
- end
- digSt(100)
- digE('up', 50)
- dropStone()
- shell.run("quarry", "-dim", "5", "5", "3", "-invert", "true")
- digE('down', 50)
- digSt(100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement