Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sideLength = 9
- local inspectAttempts = 5
- local desiredFuelPercent = 0.5
- local move = {
- forward = function()
- while not turtle.forward() do
- turtle.dig()
- end
- end,
- up = function()
- while not turtle.up() do
- turtle.digUp()
- end
- end,
- down = function()
- while not turtle.down() do
- turtle.digDown()
- end
- end
- }
- local checkBlock = {
- forward = function(name)
- local i
- for i = 1, inspectAttempts do
- local success, blockData = turtle.inspect()
- if success then
- return blockData.name:find(name) ~= nil
- end
- end
- end,
- up = function(name)
- local i
- for i = 1, inspectAttempts do
- local success, blockData = turtle.inspectUp()
- if success then
- return blockData.name:find(name) ~= nil
- end
- end
- end,
- down = function(name)
- local i
- for i = 1, inspectAttempts do
- local success, blockData = turtle.inspectDown()
- if success then
- return blockData.name:find(name) ~= nil
- end
- end
- end
- }
- local function doAction()
- turtle.placeDown()
- end
- while true do
- turtle.select(1)
- move.forward()
- doAction()
- local i, j
- for i = 1, sideLength do
- for j = 1, sideLength - 1 do
- move.forward()
- doAction()
- end
- if i < sideLength then
- if i % 2 == 1 then
- turtle.turnRight()
- move.forward()
- doAction()
- turtle.turnRight()
- else
- turtle.turnLeft()
- move.forward()
- doAction()
- turtle.turnLeft()
- end
- end
- end
- move.forward()
- turtle.turnRight()
- turtle.turnRight()
- if
- turtle.getFuelLevel() ~= 'unlimited' and checkBlock.down('condenser') and
- turtle.getFuelLevel() < turtle.getFuelLimit() * desiredFuelPercent
- then
- turtle.select(16)
- turtle.suckDown()
- turtle.refuel()
- end
- sleep(60)
- end
Advertisement
Add Comment
Please, Sign In to add comment