From d2ca23d17987af97a1d5fe7cf426071eb4174eb1 Mon Sep 17 00:00:00 2001 From: Emerson Rosen-Jones Date: Sat, 9 Aug 2025 01:08:47 -0400 Subject: [PATCH] Program to control a create quarry --- quarry_control.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 quarry_control.lua diff --git a/quarry_control.lua b/quarry_control.lua new file mode 100644 index 0000000..31831a2 --- /dev/null +++ b/quarry_control.lua @@ -0,0 +1,44 @@ +local MOVE_DIR = -1 +local MINE_DIR = -2 +local HEIGHT = 124 + +local SEQ_SIDE = "back" +local RS_SIDE = "left" +local DIG_MULT = 20 + +local seq = peripheral.wrap(SEQ_SIDE) + +function setMove () + rs.setOutput(RS_SIDE, false) +end + +function setMine () + rs.setOutput(RS_SIDE, true) +end + +function proceed () + setMove() + seq.move(2, MOVE_DIR) + sleep(1) + while seq.isRunning() do + sleep(1) + end +end + +function dig () + setMine() + seq.move(HEIGHT * DIG_MULT, MINE_DIR) + while seq.isRunning() do + sleep(8) + end + seq.move(HEIGHT, -MINE_DIR) +end + +while true do + print("Proceed? [y/N]") + local response = read() + if response == "y" or response == "Y" then + proceed() + end + dig() +end