Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --name Digger
- --version 1.0a
- local version = "1.0a"
- local args = {...}
- local limX, limY
- local function forward()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- local function screen(txt)
- term.clear()
- term.setCursorPos(1,1)
- print("Digger (v%s)",version)
- print("------------------")
- print(txt)
- end
- local function turn(x,z)
- if x == limX then
- if z%2 == 0 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- elseif (x == 1) and (z ~= 1) then
- if z%2 == 1 then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- end
- end
- if #args ~= 2 then
- print("Usage: Digger [x] [z]")
- else
- limX = tonumber(args[1])
- limZ = tonumber(args[2])
- for z=1,limZ do
- for x=1,limX do
- screen(string.format("X:%d Z:%d",x,z))
- turtle.digUp()
- turtle.digDown()
- turn(x,z)
- if(x<limX) or (z<limZ) then
- forward()
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment