Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- mining program
- local currentPosition = vector.new(gps.locate(5))
- local startPos = vector.new(gps.locate(5))
- function getPosition()
- currentPosition = vector.new(gps.locate(5))
- end
- function digAround()
- for i = 0, 3, 1 do
- turtle.dig()
- turtle.turnRight()
- end
- end
- function moveUp()
- while currentPosition.y < startPos.y do
- turtle.up()
- getPosition()
- end
- end
- function firstRun()
- print("Going down!")
- while currentPosition.y > 13 do
- print("Current Y position: " .. currentPosition.y)
- turtle.digDown()
- turtle.down()
- print("Getting new position...")
- getPosition()
- end
- end
- function secondRun()
- while currentPosition.y > 3 do
- print("Digging...")
- digAround()
- turtle.digDown()
- if not turtle.down() then
- break
- end
- getPosition()
- end
- end
- firstRun()
- print("We are at Y 13!")
- print("Initiating lower-dig protocol...")
- secondRun()
- print("Going back up!")
- moveUp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement