add getBlocks

This commit is contained in:
Navid Sassan 2023-11-23 00:24:54 +01:00
parent 2d06761280
commit 27a8348ced

29
getBlocks.lua Normal file
View File

@ -0,0 +1,29 @@
local args = { ... }
if #args < 1 then
print("Usage: getBlocks <number>")
return
end
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!")