Advertisement
Guest User

startup

a guest
Dec 19th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. r1 = peripheral.wrap("BigReactors-Reactor_3")
  2. mon = peripheral.wrap("monitor_7")
  3. mon2 = peripheral.wrap("monitor_6")
  4.  
  5. --Function For Reactor Control
  6. ONOFF = function()
  7.  
  8.   while true do
  9.     if r1.getEnergyStored() >= 9500000 then
  10.       r1.setActive(false)
  11.     elseif r1.getEnergyStored() <= 1000000 then
  12.       r1.setActive(true)
  13.     end
  14.   sleep(0)
  15.   end
  16. end
  17.  
  18. --Function For ReactorRod Control
  19. ROD = function()
  20.  
  21.   while true do
  22.  
  23.     if r1.getEnergyStored() >= 8000000 then
  24.       r1.setAllControlRodLevels(90)
  25.     elseif r1.getEnergyStored() <= 4000000 then
  26.       r1.setAllControlRodLevels(0)
  27.     end
  28.   sleep(0)
  29.   end
  30. end
  31.  
  32. --Function For ReactorStats
  33. R1 = function()
  34.  
  35. while true do
  36.  
  37.   mon.clear()
  38.   mon.setCursorPos(1,1)
  39.   mon.setTextColor(colors.white)
  40.   mon.write("REACTOR 1: ")
  41.  
  42.     if r1.getActive() then
  43.       mon.setTextColor(colors.lime)
  44.       mon.write("ONLINE")
  45.     else
  46.       mon.setTextColor(colors.red)
  47.       mon.write("OFFLINE")
  48.     end
  49.  
  50.   mon.setCursorPos(2,3)
  51.   mon.setTextColor(colors.white)
  52.   mon.write("RF/T: ")
  53.   mon.setTextColor(colors.yellow)
  54.   mon.write(math.floor(r1.getEnergyProducedLastTick()))
  55.  
  56.   mon.setCursorPos(2,4)
  57.   mon.setTextColor(colors.white)
  58.   mon.write("Total RF: ")
  59.   mon.setTextColor(colors.yellow)
  60.   mon.write(math.floor(r1.getEnergyStored()))
  61.  
  62.   mon.setCursorPos(2,5)
  63.   mon.setTextColor(colors.white)
  64.   mon.write("Fuel: ")
  65.   mon.setTextColor(colors.yellow)
  66.   mon.write(math.floor(r1.getFuelAmount()))
  67.  
  68.  
  69.   sleep(2)
  70.  end
  71. end
  72.  
  73. --Function for TouchScreen
  74. button = function()
  75.  
  76. while true do
  77.  
  78.   mon2.setBackgroundColor(colors.black)
  79.   mon2.clear()
  80.   mon2.setTextScale(1)
  81.   mon2.setBackgroundColor(colors.green)
  82.   mon2.setTextColor(colors.black)
  83.   mon2.setCursorPos(2,2)
  84.   mon2.write("Start")
  85.   mon2.setBackgroundColor(colors.red)
  86.   mon2.setCursorPos(2,4)
  87.   mon2.write("Stop ")
  88.   event, side, x, y = os.pullEvent("monitor_touch")
  89.  
  90.     if x > 1 and x < 7 and y == 2 then
  91.       r1.setActive(true)
  92.     elseif x > 1 and x < 7 and y == 4 then
  93.       r1.setActive(false)
  94.     end
  95.    
  96.   sleep(0)
  97.   end
  98. end
  99.  
  100. parallel.waitForAny (ONOFF, ROD, R1, button)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement