summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-04 02:12:21 +0100
committerubq323 <ubq323@ubq323.website>2024-04-04 02:12:21 +0100
commit957167e4e766cec2ca20fe8a0916295a87a352f3 (patch)
treea756b8f09a3df7d860aa32088f5b63048fb84c89
parent03f9fe6a87eb7e2339ae62c87bb0629aba260c2e (diff)
launch cactus
-rw-r--r--cactus.lua76
1 files 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()