Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon=peripheral.wrap("bottom")
- mon.clear()
- mon.setTextScale(1)
- mon.setCursorPos(1,1)
- managerID = os.computerID()
- print("Manager "..managerID.." online.")
- rednet.broadcast("Manager 66 is online")
- --rednet.announce()
- --print(os.computerID())
- jobAvailable = true
- -- find beginning and end block and edit below accordingly
- -- diametric
- xStart = -207
- zStart = 99
- xEnd = -180
- zEnd = 70
- qDist = 11
- xNextJob = xStart
- zNextJob = zStart
- -- fill this in hardcoded below
- yNextJob = 64
- rednet.close("right")
- rednet.open("right")
- function setNextJob()
- zNextJob = zNextJob - qDist
- if zNextJob < zEnd then
- zNextJob = zStart
- xNextJob = xNextJob - qDist
- if xNextJob < xEnd then
- jobAvailable = false
- end
- end
- end
- while jobAvailable do
- --rednet.announce()
- print("Job manager "..managerID.." waiting for connection...")
- id, message, dist = rednet.receive()
- print("Turtle "..id.." needs a job...")
- -- if jobAvailable then
- if message == "getJob" then
- print("Job available at "..xNextJob.." "..zNextJob..".")
- print("Assigning job to turtle "..id..".")
- rednet.send(id, "yes")
- -- print("break")
- rednet.send(id, tostring(xNextJob))
- rednet.send(id, tostring(zNextJob))
- rednet.send(id, tostring(yNextJob))
- setNextJob()
- end
- --test
- end
- print("No more jobs available.")
- while true do
- -- else
- id, message, dist = rednet.receive()
- if message == "getJob" then
- rednet.send(id, "no")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment