Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- mine drone controller
- rednet.close("right")
- rednet.open("right")
- print("start digging at X = ")
- local xDig = read() -- 494
- print("start digging at Z = ")
- local zDig = read() -- 1140
- print("drop stuff at X = ")
- local xDrop = read() -- 487
- print("drop stuff at Y = ")
- local yDrop = read() -- 64
- print("drop stuff at Z = ")
- local zDrop = read() -- 1121
- print("drop stuff at F = ")
- local fDrop = read() -- 3
- print("how many digs in X direction?")
- local maxX = read()
- print("how many digs in Z direction?")
- local maxZ = read()
- maxX = maxX - 1
- maxZ = maxZ - 1
- local args = {xDig, zDig, xDrop, yDrop, zDrop, fDrop}
- local waitList = {}
- --local digSpots = {{0,0},{2,1},{4,2},{3,4},{1,3}}
- for X = 0,maxX do
- args[1] = xDig + X * 5
- for Z = 0,maxZ do
- args[2] = zDig + Z * 5
- msg = ""
- print("mine controller ready, next spot will be "..args[1].." "..args[2])
- repeat
- id, msg, _ = rednet.receive()
- until msg == "drone ready"
- if msg == "drone ready" then
- print("drone "..id.." reports in, sending job at "..args[1].." "..args[2])
- local curId = id
- rednet.send(id, "mine at")
- for i = 1,6 do
- id, msg, _ = rednet.receive()
- if (id == curId) and msg == "ack" then
- rednet.send(id, tostring(args[i]))
- else
- rednet.send(id, "wait")
- i = i - 1
- end
- end
- end
- id, msg, _ = rednet.receive()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment