Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg = {...}
- local t = turtle
- local ends = true
- doneval = 0
- rednet.open("right")
- turtle.refuel(1)
- local receives = 0
- local function digs(bloc)
- for is = 0, bloc - 1 do
- t.dig()
- t.forward()
- t.digUp()
- end
- end
- function digLeft(valu)
- digs(1)
- t.turnLeft()
- digs(valu - 1)
- t.turnRight()
- end
- function digRight(value)
- digs(1)
- t.turnRight()
- digs(value - 1)
- t.turnLeft()
- end
- local function dig(vals)
- for action = 0, (vals / 2) - 1 do
- digRight(vals)
- digLeft(vals)
- if receives > 0 then
- doneval = doneval + 1
- rednet.broadcast(doneval * 2)
- end
- end
- end
- if arg[1] == "w" then
- a, b, c = rednet.receive()
- end
- while ends == true do
- if arg[1] == "w" then
- print("wireless mode: active")
- if b ~= nil then
- res = b
- end
- save = arg[1]
- arg[1] = tonumber(res)
- if arg[2] == "%" then
- receives = 1
- print("percentage mode: active")
- end
- end
- if t.getFuelLevel() < 50 then
- repeat
- turtle.refuel(1)
- until t.getFuelLevel() > 50
- end
- dig(arg[1])
- sleep(3)
- ends = false
- end
- if save == "w" then
- rednet.broadcast("FINISHED")
- shell.run("dig w %")
- end
Add Comment
Please, Sign In to add comment