SHARE
TWEET

Untitled

a guest Oct 20th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  24.  
  25. while keyboard.isKeyDown == false do
  26.   x = 0
  27.   for i,j in pairs(nc_list) do
  28.     x = x+1
  29.     nc = component.proxy(j)
  30.     if nc.getEfficiency() > 99.9 then
  31.       nc.deactivate()
  32.     else
  33.       nc.activate()
  34.     end
  35.     nc_new_states[x] = nc.isProcessing()
  36.   end
  37.  
  38.   if (nc_new_states ~= nc_states) then
  39.     term.clear()
  40.     x = 0
  41.     for i in pairs(nc_new_states) do
  42.       x = x+1
  43.       if i then
  44.         state = 'activated!'
  45.       else
  46.         state = 'deactivated!'
  47.       end
  48.       print('Fusion Core ' .. x .. ' is ' .. state)
  49.     end
  50.   end
  51.  
  52.   nc_states = nc_new_states
  53.   os.sleep(1)
  54. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top