Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Simple Tunnel
- -- pastebin get ZBceps6U simpleTunnel
- -- simpleTunnel 75
- -- DESCRIPTION
- -- Like the default tunnel program, but instead of mining a 3x2 tunnel, this program will mine a 1x2 tunnel.
- local argv = {...}
- local mine_dist = tonumber(argv[1])
- local CONST_TORCH_INTERVAL = 8
- local curr_dist = 0
- local function check_fuel()
- if turtle.getFuelLevel() < 80 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- local function select_cobble()
- for s=2, 16 do
- local item_data = turtle.getItemDetail(s)
- if item_data then
- if item_data.name == "minecraft:cobblestone" then
- turtle.select(s)
- return true
- end
- end
- end
- return false
- end
- local function select_torch()
- for s=2, 16 do
- local item_data = turtle.getItemDetail(s)
- if item_data then
- if item_data.name == "minecraft:torch" then
- turtle.select(s)
- return true
- end
- end
- end
- return false
- end
- local function tick()
- check_fuel()
- while not turtle.forward() do
- turtle.dig()
- end
- if turtle.detectUp() then
- turtle.digUp()
- end
- if (not turtle.detectDown()) and select_cobble() then
- turtle.placeDown()
- end
- if (curr_dist > 0 and curr_dist % CONST_TORCH_INTERVAL == 0) and select_torch() then
- if (not turtle.placeUp()) and select_cobble() then
- turtle.up()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.down()
- select_torch()
- turtle.placeUp()
- end
- end
- curr_dist = curr_dist + 1
- end
- print("Beginning tunnel of length " .. tostring(mine_dist))
- while curr_dist < mine_dist do
- tick()
- end
- print("Success!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement