Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. component = require("component")
  2. local term = require("term")
  3. keyboard = component.proxy(component.list("keyboard")())
  4.  
  5. nc_list = {}
  6. nc_states = {}
  7. nc_new_states = {}
  8.  
  9. x = 0
  10. for i,j in pairs(component.list()) do
  11. if j == "nc_fusion_reactor" then
  12. x = x+1
  13. nc_list[x] = i
  14. end
  15. end
  16.  
  17. x = 0
  18. for k,j in pairs(nc_list) do
  19. x = x + 1
  20. nc_states[x] = component.proxy(j).isProcessing()
  21. end
  22.  
  23. while keyboard.isKeyDown == true do
  24. os.sleep(1)
  25. end
  26.  
  27. while keyboard.isKeyDown == false do
  28. x = 0
  29. for i,j in pairs(nc_list) do
  30. x = x+1
  31. nc = component.proxy(j)
  32. if nc.getEfficiency() > 99.9 then
  33. nc.deactivate()
  34. else
  35. nc.activate()
  36. end
  37. nc_new_states[x] = nc.isProcessing()
  38. end
  39.  
  40. if (nc_new_states ~= nc_states) then
  41. term.clear()
  42. x = 0
  43. for i in pairs(nc_new_states) do
  44. x = x+1
  45. if i then
  46. state = 'activated!'
  47. else
  48. state = 'deactivated!'
  49. end
  50. print('Fusion Core ' .. x .. ' is ' .. state)
  51. end
  52. end
  53.  
  54. nc_states = nc_new_states
  55. os.sleep(1)
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement