Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tArgs = {...}
- height = tArgs[1]
- length = tArgs[2]
- if not tArgs[1] or not tArgs[2] then
- print("Usage: mineTunnel height length")
- return(0)
- end
- --if height <= 1 then
- -- print("Height must be aleast 2. Setting it to 2")
- -- height = 2
- --end
- function refuel()
- if turtle.getFuelLevel() < 1 then
- print("Refueling")
- turtle.select(1)
- turtle.refuel()
- end
- end
- function torch(spacing)
- turtle.select(3)
- if math.fmod(spacing,5) == 0 then
- print("Placing torch")
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- function dig(far,tall)
- for i=1, far do
- refuel()
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- for j=1, tall do
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.up()
- end
- for j=1, tall do
- turtle.down()
- end
- torch(i)
- end
- end
- function unload(far)
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.up()
- for i=1, far do
- turtle.forward()
- end
- turtle.down()
- turtle.select(2)
- turtle.place()
- for i=4, 16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function check()
- turtle.select(1)
- local data = turtle.getItemDetail()
- if not data then
- print("Please put coal in slot 1")
- error()
- elseif data.name ~= "minecraft:coal" then
- print("Please put coal in slot 1")
- error()
- end
- turtle.select(2)
- data = turtle.getItemDetail()
- if not data then
- print("Please put a chest in slot 2")
- error()
- elseif data.name ~= "minecraft:chest" then
- print("Please put a chest in slot 2")
- error()
- end
- end
- check()
- dig(length,height)
- unload(length)
- print("Done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement