Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function floodField()
- print("Flooding field")
- rs.setOutput("right", true) -- flood the field
- os.sleep(10)
- rs.setOutput("right", false)
- end
- local tickCount = 0
- local tickThreshold = 60000 -- 50 minutes
- local checkTimer = 60
- if fs.exists("tickCount") then
- file = io.open("tickCount", "r")
- tickCount = file:read()
- file:close()
- else
- floodField()
- end
- while true do
- -- start timer
- mainTimer = os.startTimer(checkTimer)
- -- wait for timer to elapse
- event, event1, event2, event3 = os.pullEvent("timer")
- -- add ticks to tick counter
- tickCount = tickCount + (checkTimer * 20)
- -- if tick counter greater than tick threshold then flood
- if tickCount >= tickThreshold then
- floodField()
- tickCount = 0
- end
- file = io.open("tickCount", "w")
- file:write(tickCount)
- file:close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement