Advertisement
Guest User

R

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