Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- local distance = tonumber(args[1])
- local fuelSlot = 15
- local torchSlot = 16
- function refuel()
- while turtle.getFuelLevel() < 1000 do
- term.clear()
- print("This computer is running out of Fuel")
- print("Looking for fuel in slot 15")
- turtle.select(fuelSlot)
- turtle.refuel()
- turtle.select(1)
- -- Fuel up
- -- Include message when computer can't find fuel
- os.sleep(1)
- end
- end
- function placeTorch()
- turtle.select(16)
- turtle.placeDown()
- end
- function digForward()
- refuel()
- turtle.select(1)
- while not turtle.forward() do
- turtle.dig()
- end
- end
- function digBackward()
- refuel()
- turtle.select(1)
- for i=1,2 do
- turtle.turnLeft()
- end
- while not turtle.forward() do
- turtle.dig()
- end
- end
- function digUp()
- refuel()
- turtle.select(1)
- turtle.digUp()
- end
- function digDown()
- refuel()
- turtle.select(1)
- turtle.digDown()
- end
- function digLeft()
- refuel()
- turtle.select(1)
- turtle.turnLeft()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- function digRight()
- refuel()
- turtle.select(1)
- turtle.turnRight()
- while not turtle.forward() do
- turtle.dig()
- end
- end
- function digLine(direction)
- if direction == "right" then
- digForward()
- turtle.turnRight()
- for i=1,2 do
- digUp()
- digDown()
- digForward()
- end
- digUp()
- digDown()
- turtle.turnLeft()
- elseif direction == "left" then
- digForward()
- turtle.turnLeft()
- for i=1,2 do
- digUp()
- digDown()
- digForward()
- end
- digUp()
- digDown()
- turtle.turnRight()
- end
- end
- turtle.select(1)
- if #args == 0 then
- distance = 1
- end
- local j = 0
- for i=1,distance do
- digLine("right")
- if j % 4 == 0 then
- placeTorch()
- end
- digLine("left")
- j = j + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment