Advertisement
Guest User

prog

a guest
Feb 26th, 2016
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.66 KB | None | 0 0
  1. --######################################
  2. --#      LOCAL MONITOR VARS            #
  3. --######################################
  4. local monitor = peripheral.wrap("right")
  5. local curLine = 1
  6. local monitorWidth, monitorHeight = monitor.getSize()
  7.  
  8. --######################################
  9. --#      LOCAL REACTOR VARS            #
  10. --######################################
  11. local reactor = peripheral.wrap("BigReactors-Reactor_2")
  12.  
  13. --######################################
  14. --#      FUNCTIONS                     #
  15. --######################################
  16. function clearLine()
  17.   local clear = ""
  18.   for i = 1, monitorWidth, 1 do
  19.     clear = clear.." "
  20.   end
  21.   monitor.write(clear)
  22. end
  23.  
  24. function writeLine(Text)
  25.   monitor.setCursorPos(1,curLine)
  26.   clearLine()
  27.   monitor.setCursorPos(1,curLine)  
  28.   monitor.write(Text)
  29.   curLine = curLine + 1  
  30. end
  31.  
  32. function writeSeperationLine()
  33.   monitor.setCursorPos(1,curLine)
  34.   local seperatorText = ""
  35.   for i = 1, monitorWidth, 1 do
  36.     seperatorText = seperatorText.."-"
  37.   end
  38.   monitor.write(seperatorText)
  39.   curLine = curLine + 1
  40. end  
  41.  
  42. function init()
  43.   monitor.clear()
  44.   writeLine("XXXXX XXXXX XXXXX XXXXX XXXXX")
  45.   writeLine("X   X X     X   X X       X  ")
  46.   writeLine("XXXXX XXXXX XXXXX X       X  ")
  47.   writeLine("X  X  X     X   X X       X  ")
  48.   writeLine("X   X XXXXX X   X XXXXX   X  ")
  49.   writeLine("  XXX XXX                    ")
  50.   writeLine("  X X X                      ")
  51.   writeLine("  X X  X                     ")
  52.   writeLine("  X X   X                    ")
  53.   writeLine("  XXX XXX              V. 0.1")
  54. end
  55.  
  56. function writeTime()
  57.   local time = os.time()
  58.   local timeString = textutils.formatTime(time)
  59.   monitor.setCursorPos(1,monitorHeight)
  60.   clearLine()
  61.   monitor.setCursorPos(1,monitorHeight)
  62.   monitor.write(timeString)
  63. end
  64.  
  65. function reactorInfo()
  66.   curLine = 12
  67.   if reactor.getFuelAmount() < 155000 then
  68.     writeLine("!!Reactor needs Fuel!!")
  69.   end
  70.   if reactor.getActive() then
  71.     writeLine("Reactor: Active")
  72.     if reactor.getEnergyStored() > 9000000 then
  73.       reactor.setActive(false)
  74.     end  
  75.   else
  76.     writeLine("Reactor: Inactive")
  77.     if reactor.getEnergyStored() == 0 then
  78.       reactor.setActive(true)
  79.     end
  80.   end
  81.   writeLine("Energy-Storage:   "..reactor.getEnergyStored())
  82.   writeLine("EnergyProduction: "..reactor.getEnergyProducedLastTick())
  83.   writeLine("Fuel:             "..reactor.getFuelAmount().." mb")
  84.   writeLine("")
  85.   writeLine("")
  86. end
  87.  
  88. --######################################
  89. --#         MAIN PROGRAMM              #
  90. --######################################
  91. init()
  92. writeSeperationLine()
  93. while true do
  94.   reactorInfo()
  95.   writeTime()
  96.   sleep(1)
  97. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement