Initial files

This commit is contained in:
Jef Roosens 2020-12-28 14:45:50 +01:00
parent 1378189ba2
commit 6dc2343ee5
11 changed files with 758 additions and 0 deletions

26
tunnel.lua Normal file
View file

@ -0,0 +1,26 @@
-- 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({...})