Advertisement
Zeide_

Untitled

May 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. local mon = peripheral.find("monitor")
  2. local core = peripheral.find("draconic_rf_storage")
  3. local energyStored = core.getEnergyStored()
  4. local energyMax = core.getMaxEnergy()
  5. local function round(n)
  6. return n % 1 >= 0.5 and math.ceil(n) or math.floor(n)
  7. end
  8.  
  9. if energyStored < 1000 then
  10. mon.write(energyStored)
  11. elseif energyStored < 1000000 then
  12. mon.write(round(energyStored/1000))
  13. mon.write("k")
  14. elseif energyStored < 1000000000 then
  15. mon.write(round(energyStored/1000000))
  16. mon.write("M")
  17. elseif energyStored < 1000000000000 then
  18. mon.write(round(energyStored/1000000000))
  19. mon.write("G")
  20. elseif energyStored < 1000000000000000 then
  21. mon.write(round(energyStored/1000000000000))
  22. mon.write("T")
  23. elseif energyStored < 1000000000000000000 then
  24. mon.write(round(energyStored/1000000000000000))
  25. mon.write("P")
  26. elseif energyStored < 1000000000000000000000 then
  27. mon.write(round(energyStored/1000000000000000000))
  28. mon.write("E")
  29. end
  30.  
  31. mon.write(" sur ")
  32.  
  33. if energyMax < 1000 then
  34. mon.write(energyMax)
  35. elseif energyMax < 1000000 then
  36. mon.write(round(energyMax/1000))
  37. mon.write("k")
  38. elseif energyMax < 1000000000 then
  39. mon.write(round(energyMax/1000000))
  40. mon.write("M")
  41. elseif energyMax < 1000000000000 then
  42. mon.write(round(energyMax/1000000000))
  43. mon.write("G")
  44. elseif energyMax < 1000000000000000 then
  45. mon.write(round(energyMax/1000000000000))
  46. mon.write("T")
  47. elseif energyMax < 1000000000000000000 then
  48. mon.write(round(energyMax/1000000000000000))
  49. mon.write("P")
  50. elseif energyMax < 1000000000000000000000 then
  51. mon.write(round(energyMax/1000000000000000000))
  52. mon.write("E")
  53. end
  54.  
  55. mon.write("RF")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement