1
1
mirror of https://git.shadowkat.net/izaya/OC-PsychOS2.git synced 2024-12-25 20:21:25 -05:00
OC-PsychOS2/service/screenblank.lua

26 lines
574 B
Lua
Raw Normal View History

2019-07-14 06:52:56 -04:00
local lastkey = computer.uptime()
local state = true
local delay = 60
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
2019-07-14 06:52:56 -04:00
end
end
end,"screenblank")
2019-07-14 06:52:56 -04:00
end