소스 검색

screenblank works with the new rc system now, rejoyce

pull/1/head
XeonSquared 4 년 전
부모
커밋
67de47ebd4
1개의 변경된 파일19개의 추가작업 그리고 15개의 파일을 삭제
  1. +19
    -15
      service/screenblank.lua

+ 19
- 15
service/screenblank.lua 파일 보기

@@ -1,21 +1,25 @@
local lastkey = computer.uptime()
local state = true
local delay = 60
while true do
tEv = {coroutine.yield()}
if tEv[1] == "key_down" then
lastkey = computer.uptime()
if not state then
for addr in component.list("screen") do
component.invoke(addr,"turnOn")
function start()
return os.spawn(function()
while true do
tEv = {coroutine.yield()}
if tEv[1] == "key_down" then
lastkey = computer.uptime()
if not state then
for addr in component.list("screen") do
component.invoke(addr,"turnOn")
end
state = true
end
end
if computer.uptime() > lastkey + delay and state then
for addr in component.list("screen") do
component.invoke(addr,"turnOff")
end
state = false
end
state = true
end
end
if computer.uptime() > lastkey + delay and state then
for addr in component.list("screen") do
component.invoke(addr,"turnOff")
end
state = false
end
end,"screenblank")
end

불러오는 중...
취소
저장