From a2a87db49cb83fddd830ac90a05e3ad58aa0a7e7 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Thu, 29 Nov 2018 02:07:11 -0500 Subject: [PATCH] milo: cobblegen --- milo/apps/cobblegen.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 milo/apps/cobblegen.lua diff --git a/milo/apps/cobblegen.lua b/milo/apps/cobblegen.lua new file mode 100644 index 0000000..a86d2ac --- /dev/null +++ b/milo/apps/cobblegen.lua @@ -0,0 +1,30 @@ +_G.requireInjector(_ENV) + +local Util = require('util') + +local fs = _G.fs +local os = _G.os +local turtle = _G.turtle + +local STARTUP_FILE = 'usr/autorun/cobbleGen.lua' + +if not fs.exists(STARTUP_FILE) then + Util.writeFile(STARTUP_FILE, + [[os.sleep(1) +shell.openForegroundTab('packages/milo/apps/cobblegen')]]) +end + +os.queueEvent('turtle_inventory') +while true do + print('waiting') + os.pullEvent('turtle_inventory') + print('waiting for cobble') + for _ = 1, 20 do + if turtle.inspectDown() then + break + end + os.sleep(.1) + end + print('digging') + turtle.digDown() +end \ No newline at end of file