Program to control a create quarry
This commit is contained in:
parent
433eff9af9
commit
d2ca23d179
1 changed files with 44 additions and 0 deletions
44
quarry_control.lua
Normal file
44
quarry_control.lua
Normal file
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue