xavierlebel

power 3

Mar 3rd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("monitor_2")
  2. bank = peripheral.wrap("blockcapacitorbank_3")
  3. -- backup = peripheral.wrap("cofh_thermalexpansion_energycell_2")
  4. p = peripheral.wrap("back")
  5.  
  6. function pulse()
  7. redstone.setOutput("back", true)
  8. end
  9.  
  10. while true do
  11.  
  12. mon.clear()
  13.  
  14. mon.setTextScale(1.5)
  15. mon.setCursorPos(1,1)
  16.  
  17. energy = bank.getEnergyStored("left")
  18. mj = bank.getMJStored("left")
  19. mjmax = bank.getMaxMJReceived("left")
  20.  
  21.   if bank.getMJStored("left") < 5000000 then
  22.     p.setFreq(201)
  23.     pulse()
  24.     mon.setTextColor(colors.white)
  25.     mon.write("POWER MANAGEMENT V3")
  26.     mon.setCursorPos(1,3)
  27.     mon.setTextColor(colors.red)
  28.     mon.write("ENERGY CRITICAL")
  29.     mon.setCursorPos(1,4)
  30.     mon.write("RF:" ..energy)
  31.     mon.setCursorPos(1,5)
  32.     mon.write("MJ:" ..mj)
  33.     mon.setCursorPos(1,7)
  34.     mon.setTextColor(colors.green)
  35.     mon.write("CHARGING...                  ")
  36.     mon.setCursorPos(1,8)
  37.     mon.write("SPEED (MJ/t):" ..mjmax)
  38.     sleep(5)
  39.  
  40.   else if bank.getMJStored("left") > 17500000 then
  41.     p.setFreq(202)
  42.     pulse()
  43.     mon.setTextColor(colors.white)
  44.     mon.write("POWER MANAGEMENT V3")
  45.     mon.setCursorPos(1,3)
  46.     mon.setTextColor(colors.green)
  47.     mon.write("ENERGY OK")
  48.     mon.setCursorPos(1,4)
  49.     mon.write("RF:" ..energy)
  50.     mon.setCursorPos(1,5)
  51.     mon.write("MJ:" ..mj)
  52.     mon.setCursorPos(1,7)
  53.     mon.write("ALL SYSTEMS ARE OK")
  54.     mon.setCursorPos(1,8)
  55.     mon.write("CHARGING AT 22.5%")
  56.     sleep(10)
  57.  
  58.   else
  59.     p.setFreq(203)
  60.     pulse()
  61.     mon.setTextColor(colors.white)
  62.     mon.write("POWER MANAGEMENT V3")
  63.     mon.setCursorPos(1,3)
  64.     mon.setTextColor(colors.yellow)
  65.     mon.write("ENERGY LOW")
  66.     mon.setCursorPos(1,4)
  67.     mon.write("RF:" ..energy)
  68.     mon.setCursorPos(1,5)
  69.     mon.write("MJ:" ..mj)
  70.     mon.setCursorPos(1,7)
  71.     mon.write("POWER IS LOW")
  72.     mon.setCursorPos(1,8)
  73.     mon.write("CHARGING AT 22.5%")
  74.     sleep(10)
  75.  
  76.   end
  77.   end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment