Advertisement
Guest User

Untitled

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