Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
110
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. nc_new_states = {}
  7.  
  8. x = 0
  9. for i,j in pairs(component.list()) do
  10. if j == "nc_fusion_reactor" then
  11. x = x+1
  12. nc_list[x] = i
  13. end
  14. end
  15.  
  16. x = 0
  17. for k,j in pairs(nc_list) do
  18. x = x + 1
  19. nc_states[x] = component.proxy(j).isProcessing()
  20. end
  21.  
  22.  
  23.  
  24. while true do
  25. x = 0
  26. for i,j in pairs(nc_list) do
  27. x = x+1
  28. nc = component.proxy(j)
  29. if nc.getEfficiency() > 99.9 then
  30. nc.deactivate()
  31. else
  32. nc.activate()
  33. end
  34. nc_new_states[x] = nc.isProcessing()
  35. end
  36.  
  37. if (nc_new_states ~= nc_states) then
  38. term.clear()
  39. x = 0
  40. for i in nc_new_states() do
  41. x = x+1
  42. if i then
  43. state = 'actived!'
  44. else
  45. state = 'deactivated!'
  46. end
  47. print('Fusion Core ' .. x .. ' is ' .. state)
  48. end
  49. end
  50.  
  51. nc_states = nc_new_states
  52. os.sleep(1)
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement