Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local rightTurn
- local top
- local pos
- local x
- local y
- local z
- local chunkStartLoc = args[1]
- function pokeHole()
- end
- function digIfShould()
- if shouldIDigHere() then
- turtle.digDown()
- pokeHole()
- end
- end
- function shouldIDigHere()
- pos = vector.new(gps.locate(5))
- truncateVectorComsToXYZ(pos)
- if isint(x/5) and isint(z/5) then
- return true
- else
- if isint((x-2)/5) and isint((z-1)/5) then
- return true
- else
- if isint((x+1)/5) and isint((z-2)/5) then
- return true
- else
- if isint((x-1)/5) and isint((z+2)/5) then
- return true
- else
- if isint((x+2)/5) and isint((z+1)/5) then
- return true
- else
- return false
- end
- end
- end
- end
- end
- end
- function truncateVectorComsToXYZ(vec)
- x = math.modf(vec.x)
- y = math.modf(vec.y)
- z = math.modf(vec.z)
- end
- function isint(num)
- return num==math.floor(num)
- end
- function turn21()
- digIfShould()
- if rightTurn then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- rightTurn = false
- else
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- rightTurn = true
- end
- end
- function main()
- if not args[1] then
- print("ERROR: Need turtle start location!")
- exit()
- end
- if chunkStartLoc == "left" then
- rightTurn = true
- else
- rightTurn = false
- end
- for i=1, 15 do
- for j=1, 15 do
- digIfShould()
- turtle.forward()
- end
- turn21()
- end
- for i=1, 15 do
- digIfShould()
- turtle.forward()
- end
- digIfShould()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement