27 lines
615 B
Lua
27 lines
615 B
Lua
-- Created by Jef Roosens
|
|
--
|
|
-- This script digs a 1x2 tunnel of a given length
|
|
|
|
local logger = require("jlib.log").init_logger(3)
|
|
local fuel = require("jlib.fuel")
|
|
fuel.logger = logger
|
|
local move = require("jlib.move").move
|
|
local input = require("jlib.input")
|
|
|
|
|
|
local function main(args)
|
|
-- Get tunnel length
|
|
local length = tonumber(args[1]) or input.read_int("Tunnel length: ")
|
|
|
|
-- Check if fuel is sufficient
|
|
if not fuel.check(length) then
|
|
return logger:log(1, "Insufficient fuel.")
|
|
end
|
|
|
|
-- Do the digging
|
|
move('f', length, { turtle.digDown, turtle.digUp })
|
|
end
|
|
|
|
|
|
main({...})
|