ClocxHD

Untitled

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