ClocxHD

Untitled

Oct 15th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while true do
  2.   local reactor1 = peripheral.wrap("BigReactors-Reactor_1")
  3.   local monitors = {
  4.     peripheral.wrap("monitor_3"),
  5.   }
  6.  
  7.   -- Funktionen fåBCr mehrere Monitore
  8.  
  9.   local function clear()
  10.     for _,mon in pairs(monitors) do
  11.       mon.clear()
  12.     end
  13.   end
  14.  
  15.   local function textScale()
  16.     for _,mon in pairs(monitors) do
  17.       mon.setTextScale(2)
  18.     end
  19.   end
  20.  
  21.   local function cursorPos(left, top)
  22.     for _,mon in pairs(monitors) do
  23.       mon.setCursorPos(left, top)
  24.     end
  25.   end
  26.  
  27.   local function textColor(color)
  28.     for _,mon in pairs(monitors) do
  29.       mon.setTextColor(color)
  30.     end
  31.   end
  32.  
  33.   local function print_on_screen(text)
  34.     for _,mon in pairs(monitors) do
  35.       mon.write(text)
  36.     end
  37.   end
  38.  
  39.   -- Begin Reactor 2
  40.  
  41.   clear()
  42.   textScale()
  43.   cursorPos(1,1)
  44.   textColor(colors.white)
  45.   print_on_screen("Reaktor 2 aktiv: ")
  46.   if reactor1.getActive() == true then
  47.     textColor(colors.lime)
  48.     print_on_screen("Ja")
  49.   else
  50.     textColor(colors.red)
  51.     print_on_screen("Nein")
  52.   end
  53.  
  54.   cursorPos(1,4)
  55.   textColor(colors.white)
  56.   print_on_screen("Temperatur: ")
  57.   textColor(colors.lime)
  58.   print_on_screen(math.floor(reactor1.getTemperature()))
  59.   print_on_screen(" C")
  60.  
  61.   cursorPos(1,5)
  62.   textColor(colors.white)
  63.   print_on_screen("Control-Rods: ")
  64.   textColor(colors.lime)
  65.   print_on_screen(math.floor(reactor1.getNumberOfControlRods()))
  66.  
  67.   cursorPos(1,6)
  68.   textColor(colors.white)
  69.   print_on_screen("Gespeicherte Energie: ")
  70.   if math.floor(reactor1.getEnergyStored()) < 10000 then
  71.     textColor(colors.red)
  72.   else
  73.     textColor(colors.lime)
  74.   end
  75.   print_on_screen(math.floor(reactor1.getEnergyStored()) .. " RF")
  76.  
  77.   cursorPos(1,7)
  78.   textColor(colors.white)
  79.   print_on_screen("Verschwendung: ")
  80.   if math.floor(reactor1.getWasteAmount()) > 100 then
  81.     textColor(colors.red)
  82.   else
  83.     textColor(colors.lime)
  84.   end
  85.   print_on_screen(math.floor(reactor1.getWasteAmount()) .. " mB")
  86.  
  87.   cursorPos(1,8)
  88.  
  89.   if math.floor(reactor1.getEnergyStored()) < 8000000 then
  90.     reactor1.setAllControlRodLevels(0)
  91.     textColor(colors.white)
  92.     print_on_screen("Control-Rods Level: ")
  93.     textColor(colors.red)
  94.     print_on_screen("0")
  95.   else
  96.     reactor1.setAllControlRodLevels(80)
  97.     textColor(colors.white)
  98.     print_on_screen("Control-Rods Level: ")
  99.     textColor(colors.lime)
  100.     print_on_screen("80")
  101.   end
  102.   -- End Reactor 2
  103.  
  104.    sleep(5)
  105. end
Advertisement
Add Comment
Please, Sign In to add comment