Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Download or load turtle base functionality
- local function loadBaseFunctionality()
- if pcall(os.loadAPI, 'turtlebasefunctionality') then
- -- print('turtlebasefunctionality found, loading...')
- else
- print('turtlebasefunctionality not found, downloading from pastebin...')
- shell.run('pastebin', 'get', 'dw4vqLdf', 'turtlebasefunctionality')
- end
- end
- -- Load base functionality
- loadBaseFunctionality()
- -- Load functions from turtle base functionality
- loadfile('turtlebasefunctionality')()
- dofile('turtlebasefunctionality')
- -- Check if the number of arguments is correct
- local arguments = {...}
- if #arguments ~= 3 then
- print('Usage: cube_tunnel <width> <height> <depth>')
- return
- end
- -- Parse arguments
- local width = tonumber(arguments[1])
- local height = tonumber(arguments[2])
- local depth = tonumber(arguments[3])
- -- Check if dimensions are valid
- if width < 1 or height < 1 or depth < 1 then
- print('Dimensions must be positive integers')
- return
- end
- -- Calculate ultimate fuel requirements
- local function calculateUltimateFuelRequirements()
- return width * height * depth
- end
- -- Activate and adjust fuel requirements
- activateDiscardExcessFuel()
- changeUltimateFuelRequirementsTo(calculateUltimateFuelRequirements())
- -- Clear the screen and provide instructions
- term.clear()
- print('The turtle will dig out a cube with dimensions ' .. width .. 'x' .. height .. 'x' .. depth)
- print('')
- print('Place the turtle at the starting position.')
- print('')
- pressEnterToContinue()
- -- Check if fuel level is sufficient
- checkIfFuelLevelIsSufficient()
- -- Dig out the cube
- for y = 1, height do
- for z = 1, depth do
- for x = 1, width - 1 do
- breakFront()
- go()
- end
- if z < depth then
- breakDown()
- end
- end
- if y < height then
- breakUp()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement