xavierlebel

menu5

Mar 4th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mon = peripheral.wrap("monitor_1")
  2. bank = peripheral.wrap("blockcapacitorbank_2")
  3. p = peripheral.wrap("back")
  4. -----------------------------------
  5. function poweron()
  6. redstone.setOutput("back", true)
  7. end
  8.  
  9. function poweroff()
  10. redstone.setOutput("back", false)
  11. end
  12.  
  13. function pulse()
  14. redstone.setOutput("back", true)
  15. sleep(0.7)
  16. redstone.setOutput("back", false)
  17. end
  18.  
  19. function info()
  20.     mon.setCursorPos(2,3)
  21.     mon.write("MJ:" ..mj)
  22.     mon.setCursorPos(2,4)
  23.     mon.write("RF:" ..rf)
  24. end
  25. -----------------------------------
  26. while true do
  27. mon.clear()
  28. mon.setTextColor(colors.white)
  29. mon.setCursorPos(2,2)
  30. mon.write("CAPACITOR 1")
  31. mon.setCursorPos(20,2)
  32. mon.write("GENERATOR")
  33. -----------------------------------
  34. mj = bank.getMJStored("left")
  35. rf = bank.getEnergyStored("left")
  36. -----------------------------------
  37. if bank.getMJStored("left") <200000 then
  38.     p.setFreq(201)
  39.     poweroff()
  40.     p.setFreq(202)
  41.     pulse()
  42.     info()
  43.     mon.setTextColor(colors.red)
  44.     mon.setCursorPos(2,6)
  45.     mon.write("ENERGY CRITICAL")
  46.     mon.setCursorPos(2,7)
  47.     mon.write("CHARGING...")
  48.     sleep(20)
  49.  
  50. else if bank.getMJStored("left") >400000 then
  51.     p.setFreq(201)
  52.     poweron()
  53.     info()
  54.     mon.setTextColor(colors.green)
  55.     mon.setCursorPos(2,6)
  56.     mon.write("ENERGY OK")
  57.     mon.setCursorPos(2,7)
  58.     mon.write("PRODUCING OIL")
  59.     sleep(5)
  60.  
  61. else if bank.getMJStored("left") >100000 and bank.getMJStored("left") <400000 then
  62.     p.setFreq(201)
  63.     poweroff()
  64.     p.setFreq(202)
  65.     pulse()
  66.     info()
  67.     mon.setTextColor(colors.yellow)
  68.     mon.setCursorPos(2,6)
  69.     mon.write("ENERGY LOW")
  70.     mon.setCursorPos(2,7)
  71.     mon.write("STANDBY")
  72.     sleep(5)
  73. end
  74.  
  75. end
  76.  
  77. end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment