Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- if not fs.exists("rnc2") then
- shell.run("pastebin","get","7UH6rt36","rnc2")
- end
- os.loadAPI("rnc2")
- function GotSpongeAmount()
- local sponge = 0
- for i = 1, 16 do
- local detail = turtle.getItemDetail(i)
- if detail ~= nil and detail.name == "enderio:block_industrial_insulation" then
- sponge = sponge + detail.count
- end
- end
- if sponge == 128 then
- return true
- end
- return false
- end
- function GiveSponge()
- for i = 1, 16 do
- local detail = turtle.getItemDetail(i)
- if detail ~= nil and detail.name == "enderio:block_industrial_insulation" then
- turtle.select(i)
- end
- end
- local detail = turtle.getItemDetail(turtle.getSelectedSlot())
- if detail ~= nil and detail.name == "enderio:block_industrial_insulation" and turtle.dropDown(1) then
- return true
- end
- return false
- end
- if not GotSpongeAmount() then
- error("Not enought sponge")
- end
- local prg = shell.getRunningProgram()
- rnc2.setPort(prg, 600)
- rnc2.setIdenty(prg, 100)
- rnc2.setTimeOut(prg, 2)
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.select(1)
- turtle.placeUp()
- local tmin = 10000
- local tmax = 0
- local sucked = 1
- local ERRORS = 2
- while sucked ~= 129 do
- turtle.select(1)
- if turtle.suckUp() then
- while not turtle.placeDown() do end
- GiveSponge()
- peripheral.call("bottom", "turnOn")
- sleep(0.3)
- temp = peripheral.wrap("bottom")
- local message = "t_" .. temp.getID() .. " fg liningupsponge " .. sucked
- local expect = "t_" .. temp.getID() .. "> Command resived!"
- local res = nil
- local continue = false
- local send = true
- repeat
- res = nil
- continue = false
- --print(message)
- if send then
- rnc2.setIdenty(prg,100)
- rnc2.send(prg, message)
- send = false
- end
- rnc2.setIdenty(prg,101)
- local res = rnc2.resive(prg)
- if res == expect then
- continue = true
- --print(res)
- else
- if res == nil then
- res = "nil"
- send = true
- end
- term.setCursorPos(1,ERRORS)
- print("ERROR on " .. temp.getID() .. ":\"" .. res .. "\"")
- ERRORS = ERRORS + 1
- end
- until continue
- term.setCursorPos(1,1)
- print("success started " .. sucked)
- sucked = sucked + 1
- if temp.getID() > tmax then
- tmax = temp.getID()
- elseif temp.getID() < tmin then
- tmin = temp.getID()
- end
- end
- end
- turtle.select(1)
- turtle.digUp()
- local forward = 13
- while forward ~= 0 do
- if turtle.forward() then
- forward = forward - 1
- end
- end
- turtle.select(2)
- turtle.place()
- local backword = 13
- while backword ~= 0 do
- if turtle.back() then
- backword = backword - 1
- turtle.place()
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(3)
- turtle.place()
- turtle.select(4)
- term.setCursorPos(1,1)
- print(" ")
- sucked = 1
- while sucked ~= 129 do
- if turtle.detectUp() and turtle.digUp() and turtle.drop() then
- sucked = sucked + 1
- term.setCursorPos(1,1)
- print("success collected " .. sucked)
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(1)
- turtle.dig()
- forward = 13
- while forward ~= 0 do
- if turtle.forward() then
- forward = forward - 1
- turtle.dig()
- end
- end
- backword = 13
- while backword ~= 0 do
- if turtle.back() then
- backword = backword - 1
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.turnLeft()
- turtle.turnLeft()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement