Advertisement
endminecraffter

endreactor

Aug 9th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.63 KB | None | 0 0
  1. --##################--
  2. -- Programm by endminecraffter
  3. -- https://pastebin.com/u/endminecraffter
  4. -- Server: MyFTB.de Deutsches Minecraft modded Netzwerk
  5. -- Benoetigte Mods/Apis: Mod BigReactors
  6. --##################--
  7. function wrapPs(peripheralName)
  8. periTab={}
  9. sideTab={}
  10. if peripheralName==nil then
  11. print("Fehler")
  12. end
  13. local peripherals = peripheral.getNames()
  14. local i2 = 1
  15. for i =1, #peripherals do
  16. if peripheral.getType(peripherals[i])==peripheralName then
  17. periTab[i2]=peripheral.wrap(peripherals[i])
  18. sideTab[i2]=peripherals[i]
  19. i2=i2+1
  20. end
  21. end
  22. if periTab~={} then
  23. return periTab,sideTab
  24. else
  25. return nil
  26. end
  27. end
  28.  
  29. mon = peripheral.wrap("back")
  30. monX,monY = mon.getSize()
  31. r = wrapPs("BigReactors-Reactor")[1]
  32.  
  33. function loadmon()
  34. mon.setBackgroundColor(colors.black)
  35. mon.clear()
  36. mon.setCursorPos(17,1)
  37. mon.setTextScale(1)
  38. mon.write("endReactorControll")
  39. mon.setCursorPos(2,4)
  40. mon.setTextScale(1)
  41. mon.write("Energy: ".. getEnergy() .."%")
  42. mon.setCursorPos(2,5)
  43. mon.write("Aktiviert: ".. getRActive())
  44. mon.setCursorPos(2,6)
  45. mon.write("CoreTemp: ".. getTemper())
  46. mon.setCursorPos(2,7)
  47. mon.write("CasingTemp: ".. getCTemper())
  48. mon.setCursorPos(2,8)
  49. mon.write("Produc: ".. getProduc().." RF")
  50. mon.setCursorPos(2,9)
  51. mon.write("RodLevel: ".. getRodLevel().."%")
  52. mon.setCursorPos(2,10)
  53. mon.write("Fuel: ".. getFuel().."%")
  54. end
  55.  
  56. function getFuel()
  57. local fuel = r.getFuelAmount()
  58. local maxfuel = r.getFuelAmountMax()
  59. return math.floor((fuel/maxfuel)*100)
  60. end
  61.  
  62. function getEnergy()
  63. local amount = r.getEnergyStored()
  64. return math.floor((amount/10000000)*100)
  65. end
  66.  
  67. function getRodLevel()
  68. local rod = r.getControlRodLevel(1)
  69. return rod
  70. end
  71.  
  72. function getRActive()
  73.  
  74. local active = r.getActive()
  75. if active == false then
  76. return "Nein"
  77. else
  78. return "ja"
  79. end
  80. end
  81.  
  82. function ActiveR()
  83.  
  84. end
  85.  
  86. function DActiveR()
  87.  
  88. end
  89.  
  90. function getProduc()
  91. local produc = r.getEnergyProducedLastTick()
  92. local prod = math.floor(math.abs(produc))
  93. return prod
  94. end
  95.  
  96. function getTemper()
  97. local temp = r.getFuelTemperature()
  98. return math.floor(math.abs(temp))
  99. end
  100.  
  101. function getCTemper()
  102. local CTemp = r.getCasingTemperature()
  103. return math.floor(math.abs(CTemp))
  104. end
  105.  
  106. function drawBar()
  107. local energy = r.getEnergyStored()
  108. local maxenergy = 10000000
  109.   bar = math.floor(((energy/maxenergy)*(monX-14))+0.5)
  110.   --Draw Background Bar
  111.   mon.setCursorPos(13,monY-16)
  112.   mon.setBackgroundColor(colors.red)
  113.   mon.write(string.rep(" ", monX-14))
  114.   --Draw Perc Bar
  115.   mon.setCursorPos(13,monY-16)
  116.   mon.setBackgroundColor(colors.green)
  117.   mon.write(string.rep(" ", bar))
  118. end
  119.  
  120. while true do
  121. loadmon()
  122. drawBar()
  123. sleep(2)
  124. end
  125.  
  126.  
  127. drawBar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement