Advertisement
xavierlebel

power8

Mar 5th, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("monitor_0")
  2. cell1 = peripheral.wrap("cofh_thermalexpansion_energycell_0")
  3. cell2 = peripheral.wrap("cofh_thermalexpansion_energycell_1")
  4. cell3 = peripheral.wrap("cofh_thermalexpansion_energycell_2")
  5. cell4 = peripheral.wrap("cofh_thermalexpansion_energycell_3")
  6. p = peripheral.wrap("back")
  7. -----------------------------------
  8. rf1 = cell1.getEnergyStored("left")
  9. rf2 = cell2.getEnergyStored("left")
  10. rf3 = cell3.getEnergyStored("left")
  11. rf4 = cell4.getEnergyStored("left")
  12. energyPercent = 25
  13. -----------------------------------
  14. function poweron()
  15. redstone.setOutput("back", true)
  16. end
  17.  
  18. function poweroff()
  19. redstone.setOutput("back", false)
  20. end
  21.  
  22. function pulse()
  23. redstone.setOutput("back", true)
  24. sleep(0.7)
  25. redstone.setOutput("back", false)
  26. end
  27.  
  28. function info()
  29.     mon.setCursorPos(8,4)
  30.     mon.write("RF:" ..rf1)
  31.  
  32.     mon.setCursorPos(8,5)
  33.     mon.write("RF:" ..rf2)
  34.  
  35.     mon.setCursorPos(8,6)
  36.     mon.write("RF:" ..rf3)
  37.  
  38.     mon.setCursorPos(8,7)
  39.     mon.write("RF:" ..rf4)
  40. end
  41. -----------------------------------
  42. function getEnergy()
  43.     return cell1.getEnergyStored("left") end
  44.  
  45. function getMaxEnergy()
  46.     return cell1.getMaxEnergyStored("left") end
  47.  
  48. function getEnergyPercent()
  49.     return math.floor(getEnergy()/getMaxEnergy()*100) end
  50. -----------------------------------
  51. while true do
  52.  
  53. mon.clear()
  54. mon.setTextColor(colors.white)
  55. mon.setCursorPos(2,2)
  56. mon.write("Energy cells")
  57. mon.setCursorPos(20,2)
  58. mon.write("Generator")
  59.  
  60. mon.setCursorPos(2,4)
  61. mon.write("CELL1")
  62. mon.setCursorPos(2,5)
  63. mon.write("CELL2")
  64. mon.setCursorPos(2,6)
  65. mon.write("CELL3")
  66. mon.setCursorPos(2,7)
  67. mon.write("CELL4")
  68. -----------------------------------
  69.  
  70.     if getEnergyPercent() >= energyPercent then
  71.         info()
  72.     else
  73.         info()
  74.     end
  75.     sleep(reCheckTimer)
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement