Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- --[[
- You have to edit some variables to make the program work
- Start here
- --]]
- --You have to add the ids of your turtles to the list like below. REPLACE/DELETE THE OLD IDS
- turtles = {}
- turtles[1] = 43
- turtles[2] = 45
- turtles[3] = 46
- turtles[4] = 47
- turtles[5] = 48
- turtles[6] = 49
- turtles[7] = 50
- turtles[8] = 51
- turtles[9] = 52
- turtles[10] = 53
- turtles[11] = 56
- turtles[12] = 57
- turtles[13] = 58
- turtles[14] = 59
- turtles[15] = 60
- turtles[16] = 61
- turtles[17] = 62
- turtles[18] = 63
- --Same as above. The ids of the two chunkloader turtles are saved in that table
- chunkloadert = {}
- chunkloadert[1] = 54
- chunkloadert[2] = 65
- local chunknum = table.getn(chunkloadert)
- local num = table.getn(turtles)
- --Replace 43 with the id of the turtle directly left to the server/master turtle
- local idOfRefuelTurtle = 43
- --[[
- Dont edit the code below. Only edit the code before this comment
- --]]
- function checkFuelClient()
- for i=1,num,1 do
- rednet.send(turtles[i],"refuel")
- id,msg = rednet.receive()
- while not(id == turtles[i]) or not(msg == "done") do
- print("Error while refueling clients!")
- os.sleep(5)
- end
- end
- end
- function checkFuelServer()
- if turtle.getFuelLevel() < 100 then
- rednet.send(idOfRefuelTurtle ,"refuelM")
- turtle.up()
- turtle.turnLeft()
- turtle.select(1)
- turtle.suck()
- shell.run("refuel all")
- turtle.turnRight()
- turtle.down()
- rednet.send(idOfRefuelTurtle,"done")
- end
- end
- function cycle()
- turtle.up()
- turtle.select(15)
- turtle.place()
- turtle.up()
- turtle.select(16)
- turtle.place()
- turtle.down()
- turtle.attack()
- turtle.down()
- turtle.select(14)
- turtle.place()
- for i=1,num,1 do
- rednet.send(turtles[i],"cycle")
- end
- os.sleep(30)
- turtle.dig()
- turtle.up()
- turtle.up()
- turtle.select(16)
- turtle.dig()
- turtle.down()
- turtle.select(15)
- turtle.dig()
- turtle.down()
- end
- function moveChunkLoaders()
- for i=1,chunknum,1 do
- rednet.send(chunkloadert[i], "move")
- id,msg = rednet.receive()
- os.sleep(1)
- end
- end
- while true do
- while turtle.detect() do print("Block detected. Remove it if you want me to continue!") os.sleep(10) end
- moveChunkLoaders()
- checkFuelClient()
- checkFuelServer()
- cycle()
- turtle.forward()
- for i=1,num,1 do rednet.send(turtles[i],"go") end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment