-- Function to dig forward safely
local function digForward()
while not turtle.forward() do
turtle.dig()
end
end
-- Function to move the turtle down safely
local function moveDown()
while not turtle.down() do
turtle.digDown()
end
end
-- Function to dig stairs downwards
local function digStairsDown(count)
for i = 1, count do
turtle.dig() -- Dig forward
digForward() -- Move forward
moveDown() -- Move down
turtle.digDown() -- Dig down
end
end
-- Function to parse command line arguments
local function parseArgs(args)
local count = tonumber(args[1])
return count
end
-- Get command line arguments
local tArgs = {...}
local stairsCount = parseArgs(tArgs)
-- Check if the number of stairs is provided
if not stairsCount then
print("Usage: digStairsDown <number_of_stairs>")
return
end
-- Start digging stairs down
digStairsDown(stairsCount)
Comments
0 B
|0 👍
/0 👎
0 B
|👍
/👎