Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local witherComputers = {111, 104, 112, 113}
- local dispatchFuel
- rednet.open("right")
- local base = peripheral.wrap("top")
- local fuelRoute = {
- "north",
- "suck",
- "drop 48",
- "up 3",
- "north",
- "drop 4",
- "east 2",
- "south 2",
- "drop 4",
- "south 2",
- "west 2",
- "drop 4",
- "west 2",
- "north 2",
- "drop 4",
- "east 2",
- "down 3",
- "stop",
- }
- local function sendAll(message)
- for _, id in ipairs(witherComputers) do
- rednet.send(id, message)
- end
- end
- local function waitForResponses(good)
- local received = 0
- local waiting = {}
- for i = 1, #witherComputers do
- waiting[witherComputers[i]] = true
- end
- while true do
- local id, message = rednet.receive()
- if waiting[id] and message == good then
- received = received + 1
- waiting[id] = nil
- elseif waiting[id] and message == "fuel" then
- dispatchFuel = true
- elseif waiting[id] then
- return false
- end
- if received == #witherComputers then
- return true
- end
- end
- end
- while true do
- sendAll("construct")
- if waitForResponses("ok") then
- turtle.select(1)
- turtle.suck()
- turtle.drop(turtle.getItemCount(1) - 1)
- turtle.dropDown()
- end
- sleep(120)
- if dispatchFuel then
- base.flyQuad(fuelRoute)
- dispatchFuel = false
- sleep(10)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement