Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- n50gd8aN
- --place turtle in center of hollow hill feature at block 63 (turtle makes 64), coords +- 256,256, facing east
- --turtle will autofuel from slot 1
- --turtle will return to surface after finding charm of life or when maxSize area has been cleared
- local curX = 0
- local curY = 0
- local maxSize = 48
- local function foundItem(chest)
- print("Found a treasure chest!")
- turtle.digDown()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) > 0 then
- turtle.select(slot)
- turtle.dropDown()
- sleep(0)
- end
- end
- turtle.select(1)
- local stacks = 0
- while turtle.suck() do
- stacks = stacks + 1
- sleep(0)
- end
- turtle.select(16)
- turtle.dig()
- print("Looted " .. stacks .. "items.")
- --return to surface
- for x = 1, 64 do
- while not turtle.up() do
- turtle.digUp()
- sleep(0)
- end
- end
- turtle.place()
- for slot = 1, 16 do
- if turtle.getItemCount(slot) > 0 then
- turtle.select(slot)
- turtle.drop()
- sleep(0)
- end
- end
- turtle.select(1)
- --dig down and continue quarry
- for x = 1, 64 do
- while not turtle.down() do
- turtle.digDown()
- sleep(0)
- end
- end
- end
- local function digForward()
- local chest
- chest = peripheral.wrap("left")
- if chest then
- turtle.turnLeft()
- foundItem(chest)
- turtle.turnRight()
- end
- chest = peripheral.wrap("front")
- if chest then
- foundItem(chest)
- end
- chest = peripheral.wrap("right")
- if chest then
- turtle.turnRight()
- foundItem(chest)
- turtle.turnLeft()
- end
- while not turtle.forward() do
- sleep(0)
- turtle.dig()
- end
- turtle.digDown()
- end
- local function main()
- local reqFuel = 32 + ((maxSize / 2 - 8) * 2) + (maxSize * maxSize) + (64 * 3)
- turtle.select(1)
- while turtle.getFuelLevel() < reqFuel do
- if not turtle.refuel(1) then
- print("Req Fuel: " .. reqFuel .. " Cur Fuel: " .. turtle.getFuelLevel())
- sleep(1)
- end
- end
- turtle.dropUp()
- --dig down and position to corner of quarry area
- for x = 1, 32 do
- repeat turtle.digDown() sleep(0) until turtle.down()
- end
- turtle.turnLeft()
- for x = 1, (maxSize / 2 - 8) do
- repeat turtle.dig() sleep(0) until turtle.forward()
- end
- turtle.turnLeft()
- for x = 1, (maxSize / 2 - 8) do
- repeat turtle.dig() sleep(0) until turtle.forward()
- end
- turtle.turnLeft()
- --quarry out the level
- curX = 0
- curY = 0
- while true do
- if(curY % 2 == 0) then
- digForward()
- curX = curX + 1
- if(curX >= maxSize) then
- turtle.turnLeft()
- digForward()
- digForward()
- digForward()
- turtle.turnLeft()
- curY = curY + 3
- end
- else
- digForward()
- curX = curX - 1
- if(curX <= 0) then
- turtle.turnRight()
- digForward()
- digForward()
- digForward()
- curY = curY + 3
- if(curY > maxSize) then
- break
- else
- turtle.turnRight()
- end
- end
- end
- end
- --return to surface
- for x = 1, 64 do
- repeat turtle.digUp() sleep(0) until turtle.up()
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement