Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --> Config Settings <--
- --Time it takes for the mining wells to reach bedrock
- MINING_TIME = 110
- --Side to watch for a redstone signal, so the system will stop
- RS_DISABLE_SIDE = "top"
- function pulseSide(side)
- rs.setOutput(side, true)
- sleep(1)
- rs.setOutput(side, false)
- end
- function writeState(s)
- f = fs.open("state.txt", "w")
- f.write(s)
- f.close()
- end
- function readState()
- f = fs.open("state.txt", "r")
- local state = f.readLine()
- f.close()
- return state
- end
- function pauseExecution()
- if rs.getInput(RS_DISABLE_SIDE) then
- print "Shutting down..."
- while rs.getInput(RS_DISABLE_SIDE) do
- sleep(10)
- end
- end
- end
- while true do
- local current_state = readState()
- if current_state == "1" then
- pauseExecution()
- print("Moving forward...")
- sleep(1)
- pulseSide("left")
- sleep(4)
- pulseSide("left")
- writeState("2")
- elseif current_state == "2" then
- print("Moving force manipulator into place...")
- sleep(1)
- pulseSide("back")
- sleep(4)
- pulseSide("back")
- writeState("3")
- elseif current_state == "3" then
- print("Beginning mining...")
- sleep(1)
- pulseSide("right")
- sleep(MINING_TIME)
- print("Retracting mining apparatus...")
- pulseSide("right")
- sleep(1)
- writeState("1")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment