Advertisement
Guest User

startup

a guest
Nov 28th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.12 KB | None | 0 0
  1. --Variables:
  2. mon = peripheral.wrap("back")
  3. reactor = peripheral.wrap("BigReactors-Reactor_84")
  4. enCell1 = peripheral.wrap("cofh_thermalexpansion_energycell_3")
  5. enCell2 = peripheral.wrap("left")
  6. actif = reactor.getActive()
  7.  
  8. mon.clear()
  9. --Fonction:
  10. function getEnergy1()
  11.    return enCell1.getEnergyStored("unknow")
  12. end
  13.  
  14. function getEnergy2()
  15.    return enCell2.getEnergyStored("unknow")
  16. end
  17.  
  18. function getMaxEnergy1()
  19.    return enCell1.getMaxEnergyStored("unknow")
  20. end
  21.  
  22. function getMaxEnergy2()
  23.     return enCell2.getMaxEnergyStored("unknow")
  24. end
  25.  
  26. function getEnergyPercent1()
  27.    return math.floor(getEnergy1()/getMaxEnergy1()*100)
  28. end
  29.  
  30. function getEnergyPercent2()
  31.    return math.floor(getEnergy2()/getMaxEnergy2()*100)
  32. end
  33.  
  34. function quart1()
  35.    return math.floor(getEnergyPercent1()/25)
  36. end
  37.    
  38. function quart2()
  39.    return math.floor(getEnergyPercent2()/25)
  40. end
  41.  
  42. function affQuart1()
  43.    if quart1() == 0 then
  44.      mon.setTextColor(colors.red) mon.write("Vide")
  45.    elseif quart1() >= 1 then
  46.      mon.setTextColor(colors.orange) mon.write(quart1().. "/4  ")
  47.    elseif quart1() >= 2 then
  48.      mon.setTextColor(colors.orange) mon.write(quart1().. "/4  ")
  49.    elseif quart1() >= 3 then
  50.      mon.setTextColor(colors.yellow) mon.write(quart1().. "/4  ")
  51.    elseif quart1() == 4 then
  52.      mon.setTextColor(colors.green) mon.write("Plein") end
  53. end
  54.  
  55. function affQuart2()
  56.    if quart2() == 0 then
  57.      mon.setTextColor(colors.red) mon.write("Vide")
  58.    elseif quart2() >= 1 then
  59.      mon.setTextColor(colors.orange) mon.write(quart2().. "/4  ")
  60.    elseif quart2() >= 2 then
  61.      mon.setTextColor(colors.orange) mon.write(quart2().. "/4  ")
  62.    elseif quart2() >= 3 then
  63.      mon.setTextColor(colors.yellow) mon.write(quart().. "/4  ")
  64.    elseif quart2() == 4 then
  65.      mon.setTextColor(colors.green) mon.write("Plein") end
  66. end
  67. function fonction()
  68.   if reactor.getActive() == false then mon.setTextColor(colors.red)
  69.                                        mon.write("Arrêt") mon.setTextColor(colors.white) mon.write(" ")
  70.   else mon.setTextColor(colors.green)
  71.        mon.write("Marche") end
  72. end
  73.                  --DåA9but conditions
  74.     while true do
  75. --Condition du råA9acteur:
  76.    if getEnergyPercent1() > 95 then reactor.setActive(false)
  77.    elseif getEnergyPercent1() < 10 then reactor.setActive(true) end
  78. --Fin condition du RåA9acteur
  79. --DåA9but affichage EnergyCell RåA9acteur:
  80. mon.setCursorPos(1,2)
  81. mon.setTextColor(colors.white)
  82. mon.write("EnergyCell RåA9acteur:")
  83. mon.setTextColor(colors.green)
  84. mon.write(getEnergyPercent1())
  85. mon.setCursorPos(25,2)
  86. mon.setTextColor(colors.white)
  87. mon.write("% RF")
  88.  
  89. mon.setCursorPos(1,3)
  90. mon.setTextColor(colors.white)
  91. mon.write("Etat:")
  92. mon.write(affQuart1())
  93. --Fin affichage EnergyCell RåA9acteur
  94. --DåA9but affichage EnergyCell Base:
  95. mon.setCursorPos(1,4)
  96. mon.setTextColor(colors.white)
  97. mon.write("EnergyCell Base:")
  98. mon.setTextColor(colors.green)
  99. mon.write(getEnergyPercent2())
  100. mon.setCursorPos(21,4)
  101. mon.setTextColor(colors.white)
  102. mon.write("% RF")
  103.  
  104. mon.setCursorPos(1,5)
  105. mon.setTextColor(colors.white)
  106. mon.write("Etat:")
  107. mon.write(affQuart2())
  108. --Fin affichage EnergyCell Base
  109. --Partie RåA9acteur:
  110. mon.setCursorPos(22,7)
  111. mon.setTextColor(colors.red)
  112. mon.write("RåA9acteur:")
  113.  
  114. mon.setCursorPos(1,8)
  115. mon.setTextColor(colors.white)
  116. mon.write("ActivitåA9:")
  117. mon.write(fonction())
  118.  
  119. mon.setCursorPos(1,9)
  120. mon.setTextColor(colors.white)
  121. mon.write("Production:")
  122. mon.setTextColor(colors.green)
  123. mon.write(math.floor(reactor.getEnergyProducedLastTick()))
  124. mon.setCursorPos(16,9)
  125. mon.setTextColor(colors.white)
  126. mon.write("RF/t:")
  127.  
  128. mon.setCursorPos(1,10)
  129. mon.setTextColor(colors.white)
  130. mon.write("TempåA9rature RåA9acteur:")
  131. mon.setTextColor(colors.green)
  132. mon.write(math.floor(reactor.getCasingTemperature()))
  133. mon.setCursorPos(27,10)
  134. mon.setTextColor(colors.white)
  135. mon.write("C")
  136.  
  137. mon.setCursorPos(1,11)
  138. mon.setTextColor(colors.white)
  139. mon.write("TempåA9rature Fuel:")
  140. mon.setTextColor(colors.green)
  141. mon.write(math.floor(reactor.getFuelTemperature()))
  142. mon.setCursorPos(23,11)
  143. mon.setTextColor(colors.white)
  144. mon.write("C")
  145.  
  146. sleep(1)
  147. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement