Advertisement
Guest User

startup

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