summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-04 02:25:24 +0100
committerubq323 <ubq323@ubq323.website>2024-04-04 02:25:24 +0100
commite9b1872709d8824a9489718c8dde0a5cc6ceccb7 (patch)
tree09b7f18ef4a7c0a13f9e01df41f27e8cc5037d69
parent878328a3da3f5788fcd0786f929c6bb697574db3 (diff)
launch cactus
-rw-r--r--cactus.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/cactus.lua b/cactus.lua
index 6930d1f..17307fc 100644
--- a/cactus.lua
+++ b/cactus.lua
@@ -17,21 +17,19 @@ end
local function ensure_modem() return ensure_equipped("modem","computercraft:wireless_modem_normal") end
local function ensure_scanner() return error("aaa") end
+local POS, FACING
local function turte_pos_init()
assert(ensure_modem())
- local POS = vector.new(gps.locate())
+ POS = vector.new(gps.locate())
while turtle.detect() do turtle.turnRight() end
turtle.forward()
local newpos = vector.new(gps.locate())
turtle.back()
- local FACING = newpos - POS
-
- return POS, FACING
+ FACING = newpos - POS
end
-local POS, FACING = turte_pos_init()
local function moveby_y(delta)
local fn = turtle.up
@@ -134,12 +132,16 @@ end
local datum = vector.new(-18, 128, -1837)
-local function mainloop()
+local function setup()
+ turtle_pos_init()
+
moveto(datum)
turn_to_face(vector.new(0,0,1))
-
dump_and_refuel()
+end
+
+local function loop()
repeat
repeat
do_column()
@@ -161,6 +163,11 @@ local function mainloop()
until POS.x <= -29
+ moveto(datum)
+ turn_to_face(vector.new(0,0,1))
+
+ dump_and_refuel()
+
os.sleep(120)
end