Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("disk/json")
- function refuel()
- if turtle.getFuelLevel() < 10 then
- for i=1, 16 do
- if turtle.refuel(1) then
- break
- end
- end
- end
- end
- function soft_forward()
- while not turtle.forward() do
- a, b = turtle.inspect()
- if a then
- if string.sub(b.name, 0, 13) ~= "computercraft" then
- turtle.dig()
- end
- end
- end
- end
- function soft_down()
- while not turtle.down() do
- a, b = turtle.inspectDown()
- if a then
- if string.sub(b.name, 0, 13) ~= "computercraft" then
- turtle.digDown()
- end
- end
- end
- end
- function soft_up()
- while not turtle.up() do
- a, b = turtle.inspectUp()
- if a then
- if string.sub(b.name, 0, 13) ~= "computercraft" then
- turtle.digUp()
- end
- end
- end
- end
- function soft_dig_up()
- a, b = turtle.inspectUp()
- if a then
- if string.sub(b.name, 0, 13) ~= "computercraft" then
- turtle.digUp()
- end
- end
- end
- function soft_dig_down()
- a, b = turtle.inspectDown()
- if a then
- if string.sub(b.name, 0, 13) ~= "computercraft" then
- turtle.digDown()
- end
- end
- end
- ws, err = http.websocket("jogt.xyz:7777")
- packet = json.decode(ws.receive())
- while not turtle.suckUp(64) do sleep(1) end
- refuel()
- turtle.forward()
- for y=1, packet["y"] do
- refuel()
- soft_down()
- soft_down()
- end
- for x=1, packet["x"] do
- refuel()
- soft_forward()
- soft_dig_up()
- soft_dig_down()
- soft_forward()
- soft_dig_up()
- soft_dig_down()
- end
- if packet["x"] % 2 == 0 then
- soft_up()
- end
- if packet["y"] % 2 == 0 then
- soft_forward()
- end
- turtle.turnRight()
- for i=1, 100 do
- refuel()
- soft_forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.turnRight()
- end
Advertisement
Add Comment
Please, Sign In to add comment