From 27a8348cedf08d9312126f870a28296ce9402f7b Mon Sep 17 00:00:00 2001 From: Navid Sassan Date: Thu, 23 Nov 2023 00:24:54 +0100 Subject: [PATCH] add getBlocks --- getBlocks.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 getBlocks.lua diff --git a/getBlocks.lua b/getBlocks.lua new file mode 100644 index 0000000..b1e30ae --- /dev/null +++ b/getBlocks.lua @@ -0,0 +1,29 @@ +local args = { ... } +if #args < 1 then + print("Usage: getBlocks ") + 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!")