Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- shell.run("updater")
- function check()
- id, text = rednet.receive(2)
- end
- function checkup()
- text = false
- if not e then
- while not text do
- check()
- end
- else
- for i=1,e do
- if not text then
- check()
- end
- end
- end
- end
- function locate()
- x, y, z = gps.locate()
- end
- while true do
- e=false
- checkup()
- if text[1] == "tgoto" then
- print("movement requested")
- x3=tonumber(text[2])
- y3=tonumber(text[3])
- z3=tonumber(text[4])
- if not text[5] then
- print("no facing direction setted")
- print("default facing: north")
- fzyx="north"
- else
- fzyx=text[5]
- end
- print("goto "..x3..", "..y3..", "..z3)
- locate()
- shell.run("goto "..x.." 100 "..z)
- print("requesting chunkloader turtle")
- rednet.broadcast("chunkloader")
- text=false
- t=0
- while t < 1 do
- e=10
- checkup()
- e=false
- if text == "available" then
- t=1
- else
- rednet.broadcast("chunkloader")
- end
- if text == "available" then
- id1=id
- locate()
- rednet.send(id,"goto")
- rednet.send(id,x)
- rednet.send(id,"101")
- rednet.send(id,z)
- end
- end
- text=false
- while not text == "ready" and id == id1 do
- checkup()
- end
- rednet.broadcast("chunkloader")
- text=false
- t=0
- while t < 1 do
- e=10
- checkup()
- e=false
- if text == "available" then
- t=1
- else
- rednet.broadcast("chunkloader")
- end
- if text == "available" then
- id1=id
- locate()
- rednet.send(id1,"goto")
- rednet.send(id1,x3)
- rednet.send(id1,"101")
- rednet.send(id1,z3)
- print("going to "..x3.." "..y3.." "..z3.." "..fzyx)
- shell.run("goto "..x3.." "..y3.." "..z3.." "..fzyx)
- end
- end
- text=false
- print("arrived")
- elseif text[1] == "excavate" then
- x2 = tonumber(text[2])
- turtle.select(16)
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- shell.run("excavate")
- sleep(60)
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(16)
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- end
- text = false
- end
Add Comment
Please, Sign In to add comment