Advertisement
Guest User

ReaktorAnzeige

a guest
Jun 17th, 2019
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. local m = peripheral.wrap("right")
  2. local r = peripheral.wrap("BigReactors-Reactor_1")
  3. local epp
  4. local estored
  5. local eproz
  6. local heatcasing
  7. local heatcore
  8. local fuel
  9. local fproz
  10. local waste
  11. local wproz
  12. local ractive
  13.  
  14. function check()
  15.     ractive = r.getActive()
  16.     estored = r.getEnergyStored()
  17.     epp = r.getEnergyProducedLastTick()
  18.     heatcasing = r.getCasingTemperature()
  19.     heatcore = r.getFuelTemperature()
  20.     fuel = r.getFuelAmount()
  21.     waste = r.getWasteAmount()
  22. end
  23.  
  24. function rechnen()
  25.     eproz = (estored / 10000000) * 100
  26.     eps = math.ceil(eproz * 0.5)
  27.     fproz = (fuel / 420000) * 100
  28.     fps = math.ceil(fproz * 0.5)
  29.     wproz = (waste / 420000) * 100
  30.     wps = math.ceil(wproz * 0.5)
  31. end
  32.    
  33. function display()
  34.     m.setTextScale(1)
  35.     m.setBackgroundColor(colors.black)
  36.     m.clear()
  37.     m.setCursorPos(23,2)
  38.     m.write("Reaktor Monitor")
  39.     m.setCursorPos(7,4)
  40.     m.write("Fuel Temperature: "..math.floor(heatcore + 0.5).."å82¥B0C")
  41.     m.setCursorPos(43,4)
  42.     if ractive == true then
  43.         m.setTextColor(colors.green)
  44.         m.write("Aktiviert")
  45.     else
  46.         m.setTextColor(colors.red)
  47.         m.write("Deaktiviert")
  48.     end
  49.     m.setTextColor(colors.white)
  50.     m.setCursorPos(7,6)
  51.     m.write("Casing Temperature: "..math.floor(heatcasing + 0.5).."å82¥B0C")
  52.     m.setCursorPos(43,6)
  53.     m.write("Producing: "..math.floor(epp + 0.5).."RF/T")
  54.     m.setCursorPos(7,10)
  55.     m.write("Energy Stored")
  56.     m.setCursorPos(52,12.5)
  57.     m.write(math.floor(estored + 0.5).."RF")
  58.     m.setCursorPos(7,19)
  59.     m.write("Fuel/Waste")
  60.     m.setCursorPos(52,15.5)
  61.     m.write(math.floor(eproz + 0.5).."%")
  62.     m.setCursorPos(52,21.5)
  63.     m.write(math.floor(fproz + 0,5).."%")
  64.     m.setCursorPos(52,24.5)
  65.     m.write(math.floor(wproz + 0,5).."%")
  66.    
  67.     box(0,11,50,16,colors.red)
  68.         box(0,11,eps,16,colors.green) --Gespeicherte Energie Graph
  69.     box(0,20,50,25,colors.red)
  70.         box(0,20,fps,22,colors.green) --Fuel
  71.         box(0,23,wps,25,colors.blue) --Waste
  72. end
  73.  
  74. function box(xa,ya,xe,ye,col)
  75.     m.setTextScale(1)
  76.     m.setBackgroundColor(col)
  77.     for y = ya, ye do
  78.         for x = xa, xe do
  79.             m.setCursorPos(x,y)
  80.             m.write(" ")
  81.         end
  82.     end
  83. end
  84.  
  85. --shell.run("bg ReaktorAnzeigeGraphen")
  86.  
  87. while true do
  88.     check()
  89.     rechnen()
  90.     display()
  91.     sleep(1)
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement