Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local length = 100
- local fuelNeeded = (((length*3)*2)*3)+27)
- local function fillUp()
- while (turtle.getFuelLevel() < fuelNeeded) do
- turtle.select(1)
- if (turtle.getItemCount(1) == 0) then
- print("Please supply fuel in slot 1!")
- return false
- end
- turtle.refuel(1)
- end
- return true
- end
- local function torchCheck()
- if (((length / 3) * 2) > turtle.getItemCount(2)) then
- print("Please feed me torches in slot 2!")
- return false
- end
- return true
- end
- local function makeLight()
- turtle.select(2)
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- end
- local function dig()
- while (turtle.detect()) do
- turtle.dig()
- sleep(0.5)
- end
- end
- local function makeTunnel()
- local lengthComp = 0
- local torchplace = 0
- while (i < length) do
- dig()
- turtle.up()
- dig()
- turtle.forward()
- turtle.down()
- if lengthComp % 10 == 0 then
- makeLight()
- end
- lengthComp = lengthComp + 1
- end
- end
- local function overARow()
- local newRow = 0
- turtle.turnLeft()
- while (newRow < 3) do
- dig()
- turtle.down()
- dig()
- turtle.forward()
- turtle.up()
- newRow = newRow + 1
- end
- turtle.turnRight()
- end
- local function backToStart()
- local comeBack = 0
- turtle.turnRight()
- turtle.turnRight()
- while (comeBack < length) do
- turtle.forward()
- comeBack = comeBack + 1
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- local function checkInventory()
- local inventory = 0
- local slotsFull = 0
- while (inventory < 16) do
- inventory = inventory + 1
- slotStatus = turtle.getItemCount(inventory)
- if (slotStatus > 0) then
- slotsFull = slotsFull + 1
- end
- end
- if (slotsFull == 16) then
- return false
- end
- return true
- end
- local function returnHome()
- local i = 0
- turtle.turnLeft()
- while (i < 3) do
- turtle.forward()
- i = i + 1
- end
- end
- if fillUp() and torchCheck() then
- local rowsFromStart = 0
- while checkInventory()
- makeTunnel()
- backToStart()
- overARow()
- rowsFromStart = rowsFromStart + 1
- end
- if (rowsFromStart > 1) then
- while (returnToHome < rowsFromStart) do
- returnHome()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement