computercraft/getBlocks.lua
2023-11-23 00:25:32 +01:00

30 lines
580 B
Lua

local args = { ... }
if #args < 1 then
print("Usage: getBlocks <number>")
return
end
local numBlocks = tonumber(args[1])
if numBlocks == nil then
print("Failed to parse number of blocks")
return
end
print("Getting " .. tostring(numBlocks) .. " blocks")
for i = 1,numBlocks
do
print(tostring(i) .. "...")
--start casting
redstone.setOutput("back", true)
os.sleep(0.1) --just in case the turtles can act faster than 1 tick
redstone.setOutput("back", false)
while (not turtle.suck(1)) do
os.sleep(0.1)
end
end
print("Done!")