summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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()