Advertisement
Guest User

reactorControl.lua

a guest
Jul 17th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local component = require("component")
  2. local term = require("term")
  3. local a = {}
  4. local i = 1
  5. local lowEnergy = 1
  6. local highEnergy = 90000000
  7.  
  8.  
  9. a[1] = component.proxy("1e041384-fc3c-42f4-8bdf-a53739a3a4d4")
  10. a[2] = component.proxy("43997808-4b78-4d3b-825f-a9a89ecec434")
  11. a[3] = component.proxy("957dc433-bf68-4bdf-b838-1b6b12b2f687")
  12. a[4] = component.proxy("78af7b61-905a-4232-8faa-6fa7b730d313")
  13. a[5] = component.proxy("cab188aa-11f5-431c-a2ab-998056e95a83")
  14.  
  15.  
  16.  
  17. for i = 1, 5 do
  18.  print(a[i])
  19.  end
  20.  
  21.   function status()
  22.     local x = "true"
  23.  
  24.     if a[i].getActive() == true then
  25.       x = true
  26.     end
  27.  
  28.     if a[i].getActive() == false then
  29.       x = false
  30.     end
  31.   end
  32.  
  33.  
  34.   for j = 1, 5 do
  35.     a[j].setActive(true)
  36.   end
  37.  
  38. while i < 5 do
  39.   if a[i].getEnergyStored() < lowEnergy then
  40.     a[i].setActive (true)
  41.   end
  42.  
  43.   if a[i].getEnergyStored() > highEnergy then
  44.     a[i].setActive (false)
  45.   end
  46.  
  47.   print ("reactor Status: " .. status() )
  48.   print ("Reactor Energy: " .. a[i].getEnergyStored() )
  49.   print ("Reactor Case Temp: " .. a[i].getCastingTemperature() )
  50.   print ("Reactor Fuel Level: " .. a[i].getFuelAmount() )
  51.  
  52. os.sleep(2)
  53. term.clear()
  54.  
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement