Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cords = " "
- inv = peripheral.wrap("left")
- function refuel()
- if turtle.getFuelLevel() < 300 then
- shell.run("goto 2458 233 87")
- sleep(60)
- returnHome(0)
- end
- end
- function returnHome(units, state)
- shell.run("goto 2457 233 87")
- if state == 0 then
- print(units)
- print(state)
- for i=1, units do
- turtle.select(i)
- turtle.dropDown()
- end
- else
- turtle.select(1)
- turtle.dropDown()
- end
- end
- function collect(x, z, y, units, stack)
- turtle.select(1)
- refuel()
- shell.run("goto".." ".. x.." ".. y.." ".." ".. z)
- if stack == 0 then
- for i=1, units do
- turtle.suckUp()
- end
- else
- inv.suckSneakyUp(0,units)
- end
- turtle.select(1)
- inv.dropSneakyUp(1,1)
- returnHome(units, stack)
- end
- rednet.open("right")
- while true do
- rednet.send(912, "done")
- senderId, cords, distance = rednet.receive(5) -- Wait for a message
- print(cords)
- if senderId == 912 then
- rednet.send(912, "working")
- cords = textutils.unserialize(cords)
- if tonumber(cords[6]) < 0 then
- cords[6] = tonumber(cords[6]) /-1
- unitStack = 1
- else
- unitStack = 0
- end
- collect(cords[1], cords[2], cords[3], cords[6], unitStack)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment