From 957167e4e766cec2ca20fe8a0916295a87a352f3 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Thu, 4 Apr 2024 02:12:21 +0100 Subject: launch cactus --- cactus.lua | 76 +++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/cactus.lua b/cactus.lua index 65ebf4e..cfad203 100644 --- a/cactus.lua +++ b/cactus.lua @@ -100,12 +100,6 @@ local function moveto(target) moveby(target - POS) end - -local datum = vector.new(-18, 128, -1837) - -moveto(datum) -turn_to_face(vector.new(0,0,1)) - local function do_column() if turtle.detectDown() then turtle.digDown() @@ -115,24 +109,54 @@ local function do_column() end end -repeat - repeat - do_column() - move_linear(1) - until POS.z == -1826 - do_column() - turn_right() - move_linear(1) - turn_right() - - repeat - do_column() - move_linear(1) - until POS.z == datum.z - do_column() - turn_left() - move_linear(1) - turn_left() - -until POS.x <= -29 +local function dump_and_refuel() + local modem = peripheral.wrap"top" + local self = modem.getNameLocal() + local ch = peripheral.find"sc-goodies:diamond_barrel" + for i=1,16 do + ch.pullItems(self, i) + end + if turtle.getFuelLevel() < 1000 + for k,v in pairs(ch.list()) do + if v.name == "minecraft:lava_bucket" then + ch.pushItems(self, k, 1, 1) + turtle.select(1) + turtle.refuel() + ch.pullItems(self, 1) + break + end + end + end +end + +local datum = vector.new(-18, 128, -1837) + +local function mainloop() + moveto(datum) + turn_to_face(vector.new(0,0,1)) + + dump_and_refuel() + + -- repeat + -- repeat + -- do_column() + -- move_linear(1) + -- until POS.z == -1826 + -- do_column() + -- turn_right() + -- move_linear(1) + -- turn_right() + + -- repeat + -- do_column() + -- move_linear(1) + -- until POS.z == datum.z + -- do_column() + -- turn_left() + -- move_linear(1) + -- turn_left() + + -- until POS.x <= -29 +end +mainloop() -- cgit v1.2.3