Advertisement
Guest User

startup

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