Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- --== CONFIG ==--
- dumpChestSlot = 1
- fuelChestSlot = 2
- firstLoadSlot = 3
- lastLoadSlot = 16
- chunkSize = 8 -- Measured in blocks on each side.
- pillarHeight = 10
- spaceBetweeenChunks = 2
- minimumFuelLevel = 1000
- --== END OF CONFIG ==--
- dugBlocks = 0
- skipped = tonumber(args[1]) or 0
- function dug(actually)
- if actually then dugBlocks = dugBlocks + 1 end
- term.setCursorPos(1, 1)
- print("Blocks Dug: " .. dugBlocks)
- print("Fuel Level: " .. turtle.getFuelLevel())
- end
- function dig()
- did = turtle.detect()
- turtle.dig()
- while turtle.detect() do turtle.dig() sleep(1) end
- dug(did)
- end
- function digUp()
- did = turtle.detectUp()
- turtle.digUp()
- while turtle.detectUp() do turtle.digUp() sleep(1) end
- dug(did)
- end
- function digDown()
- did = turtle.detectDown()
- turtle.digDown()
- while turtle.detectDown() do turtle.digDown() sleep(1) end
- dug(did)
- end
- function fwd()
- dig()
- turtle.forward()
- end
- function dwn()
- digDown()
- turtle.down()
- end
- function dumpLoad()
- turtle.select(dumpChestSlot)
- digUp()
- turtle.placeUp()
- for i = firstLoadSlot, lastLoadSlot do
- turtle.select(i)
- turtle.dropUp()
- end
- turtle.select(dumpChestSlot)
- digUp()
- turtle.select(firstLoadSlot)
- end
- function refuel() -- Doesn't refuel if it doesn't have to.
- fuelLevel = turtle.getFuelLevel()
- if fuelLevel < minimumFuelLevel then
- turtle.select(fuelChestSlot)
- digUp()
- turtle.placeUp()
- turtle.suckUp()
- turtle.refuel()
- digUp()
- turtle.select(firstLoadSlot)
- end
- end
- function pillar()
- for i = 1, pillarHeight do -- Down...
- dwn()
- end
- for i = 1, pillarHeight do -- ...and back up!
- turtle.up()
- end
- dumpLoad()
- refuel()
- end
- function chunk()
- for i = 1, chunkSize do
- for j = 1, chunkSize do -- Out...
- fwd()
- if skipped == 0 then
- pillar()
- else
- skipped = skipped - 1
- end
- end
- turtle.turnRight()
- fwd()
- turtle.turnRight()
- for j = 1, chunkSize do -- ...and return!
- fwd()
- end
- if i ~= chunkSize then
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- end
- function chunkAndMove()
- chunk()
- turtle.turnLeft()
- for i = 1, spaceBetweeenChunks do
- fwd()
- end
- turtle.turnLeft()
- end
- function loop()
- while true do
- chunkAndMove()
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- dug(false)
- dumpLoad()
- refuel()
- turtle.select(firstLoadSlot)
- loop() -- It all comes together!
- -- End of file.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement