Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- xStart and zStart are where the first
- end of all the quarries will be dug. xEnd
- and zEnd are where the second end of all
- the quarries will be dug. yStart is the
- starting point of the height of each
- quarry. qDist is how far apart each quarry
- is. Make sure this is at least the size
- of the quarry. For each time one is added
- to this number another block will be put
- in between quarries.
- ]]--
- xStart = 0
- zStart = 0
- yStart = 70
- xEnd = 0
- zEnd = 0
- qDist = 11
- -- Program
- jobAvailable = true
- xNextJob = xStart
- zNextJob = zStart
- yNextJob = yStart
- local function openRednet()
- for _,side in ipairs(rs.getSides()) do
- if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
- rednet.open(side)
- return side
- end
- end
- end
- openRednet()
- print("Quarry Started.")
- function setNextJob()
- xNextJob = xNextJob - qDist
- if zNextJob < zEnd then
- zNextJob = zStart
- xNextJob = xNextJob - qDist
- if xNextJob < xEnd then
- jobAvailable = false
- print("Quarry Finished.")
- end
- end
- end
- while jobAvailable do
- id, message, dist = rednet.receive()
- if message == "getJob" then
- rednet.send(id, "yes")
- rednet.send(id, tostring(xNextJob))
- rednet.send(id, tostring(zNextJob))
- rednet.send(id, tostring(yNextJob))
- setNextJob()
- end
- end
- while true do
- id, message, dist = rednet.receive()
- if message == "getJob" then
- rednet.send(id, "no")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement