Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- local oil_block = "tfmg:oil_deposit"
- local computer_id = 1
- rednet.open("left")
- local function check_surroundings()
- local x, y, z = gps.locate()
- local results = {}
- local s, r = turtle.inspectUp()
- table.insert(results, r)
- s, r = turtle.inspectDown()
- table.insert(results, r)
- for i = 1, 4, 1 do
- s, r = turtle.inspect()
- table.insert(results, r)
- turtle.turnRight()
- end
- table.foreach(results, function(a,b)
- if type(b) == "table" and b.name == oil_block then
- rednet.send(computer_id, {{x,y,z},turtle.getFuelLevel(), true})
- error("",0)
- end
- end)
- rednet.send(computer_id, {{x,y,z},turtle.getFuelLevel(), false})
- end
- local function refuel_toss()
- for i = 1, 16, 1 do
- turtle.select(i)
- if turtle.getItemDetail(i) ~= nil and not string.find(turtle.getItemDetail().name, "coal") then
- turtle.drop()
- end
- turtle.refuel()
- end
- turtle.select(1)
- end
- local function full_down()
- repeat
- turtle.down()
- check_surroundings()
- until not turtle.digDown() and turtle.detectDown()
- end
- local function return_to_base_height()
- local x, y, z = gps.locate()
- while y ~= -59 do
- x, y, z = gps.locate()
- turtle.up()
- end
- end
- full_down()
- check_surroundings()
- return_to_base_height()
- for z = 1, 15, 1 do
- for x = 1, 15, 1 do
- refuel_toss()
- turtle.dig()
- turtle.forward()
- full_down()
- return_to_base_height()
- end
- if z % 2 == 0 then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- full_down()
- return_to_base_height()
- turtle.turnLeft()
- else
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- full_down()
- return_to_base_height()
- turtle.turnRight()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement