Advertisement
Guest User

Reactor_Control

a guest
Apr 27th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1.  
  2. local tArgs = { ... }
  3.  
  4. local sOpenedModem = nil
  5.  
  6. local function openModem()
  7. for n,sModem in ipairs( peripheral.getNames() ) do
  8. if peripheral.getType( sModem ) == "modem" then
  9. if not rednet.isOpen( sModem ) then
  10. rednet.open( sModem )
  11. sOpenedModem = sModem
  12. end
  13. return true
  14. end
  15. end
  16. print( "No modems found." )
  17. return false
  18. end
  19.  
  20. if not openModem() then
  21. print("Failed!")
  22. end
  23.  
  24. while true do
  25. command = rednet.receive()
  26.  
  27. if command == "Reactor_ON" then
  28. redstone.setOutput("back", true)
  29. print("Reactor ON!")
  30. else if command == "Reactor_OFF" then
  31. redstone.setOutput("back", false)
  32. print("Reactor OFF!")
  33. end
  34.  
  35. end
  36.  
  37. rednet.close(sOpenedModem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement