Advertisement
Techtronic

LightControlV1

Apr 3rd, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. -- Light Control v1
  2. -- Requires Spawner Control v1
  3. rednet.open("back")
  4. local id, msg, prot
  5. local stat = rs.getOutput("top")
  6. local data
  7.  
  8. local tOutputs = {
  9. ["lightsCheck"] = function()
  10.     rednet.send(id, stat)
  11. end,
  12. ["lightsOn"] = function()
  13.     rs.setOutput("top", false)
  14.     stat = rs.getOutput("top")
  15.     rednet.send(id, stat)
  16. end,
  17. ["lightsOff"] = function()
  18.     rs.setOutput("top", true)
  19.     stat = rs.getOutput("top")
  20.     rednet.send(id, stat)
  21. end
  22. }
  23.  
  24. while true do
  25.     id, msg, prot = rednet.receive()
  26.     stat = rs.getOutput("top")
  27.     if tOutputs[msg] ~= nil then
  28.         tOutputs[msg]()
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement