44 lines
734 B
Lua
44 lines
734 B
Lua
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
|