Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local l = 0
- local currentLayer = 0
- local size = 0
- function fuelcheck(y)
- local level = turtle.getFuelLevel()
- if (level < 256 * y + 16)
- then
- write("There is not enough fuel")
- os.shutdown()
- else
- write("There will be "..level - 256 * y.." fuel left")
- end
- end
- function layer()
- turtle.digDown()
- turtle.down()
- currentLayer = currentLayer + 1
- for i = 1, size, 1 do
- for j = 1, size, 1 do
- turtle.dig()
- turtle.forward()
- end
- if(i % 2 == 0)
- then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- else
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- end
- end
- end
- function initialchestDeposit()
- turtle.select(1)
- turtle.placeUp()
- local s = 1
- for i = 1, 15, 1 do
- s = s + 1
- turtle.select(s)
- turtle.dropUp()
- end
- end
- function invCheck()
- local s = 1
- for i = 1, 15, 1 do
- s = s + 1
- turtle.select(s)
- local data = turtle.getItemDetail()
- if data
- then
- turtle.down()
- deposit()
- l = l - 1
- end
- end
- end
- function chestDeposit()
- l = 0
- for i = 1, currentLayer - 1, 1 do
- turtle.up()
- l = l + 1
- end
- local s = 1
- for i = 1, 15, 1 do
- s = s + 1
- turtle.select(s)
- turtle.dropUp()
- end
- invCheck()
- for i = 1, l, 1 do
- turtle.down()
- end
- end
- function deposit()
- turtle.select(1)
- turtle.placeUp()
- local s = 1
- for i = 1, 15, 1 do
- s = s + 1
- turtle.select(s)
- turtle.dropUp()
- end
- end
- function startPosition()
- turtle.turnRight()
- for i = 1, size, 1 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- function chunk(y)
- for i = 1, y, 1 do
- layer()
- startPosition()
- print(currentLayer)
- if (currentLayer == 1)
- then
- initialchestDeposit()
- else
- chestDeposit()
- end
- end
- end
- write("How Many Layers to Remove?")
- local y = read()
- local x = y
- write("Enter Size\n")
- size = read()
- size = size - 1
- fuelcheck(y)
- print("Removing "..y.." Layers ...")
- chunk(y)
Advertisement
Add Comment
Please, Sign In to add comment