Sp1rit

ReactorOverview

Jan 7th, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 KB | None | 0 0
  1. os.loadAPI("apis/drawing")
  2. os.loadAPI("apis/nir")
  3. os.loadAPI("apis/sync")
  4.  
  5. sync.redirect(true)
  6. sync.addMonitor("top")
  7. sync.useMaxSize(true)
  8. drawing.resetScreen()
  9. drawing.drawRect({2,2},{23,10},colors.green,false)
  10. drawing.writeText("Reaktor",{4,2},colors.lime)
  11. drawing.writeText("Status:",{4,4},colors.white)
  12. drawing.writeText("Hitze:",{4,5},colors.white)
  13. drawing.writeText("Max.:",{4,6},colors.white)
  14. drawing.writeText("Rest:",{4,7},colors.white)
  15. drawing.writeText("Output:",{4,8},colors.white)
  16.  
  17. drawing.drawRect({25,2},{46,7},colors.red,false)
  18. drawing.writeText("MFSU Base",{27,2},colors.orange)
  19. drawing.writeText("Energie:",{27,4},colors.white)
  20. drawing.writeText("Max.:",{27,5},colors.white)
  21.  
  22. drawing.drawRect({25,9},{46,14},colors.red,false)
  23. drawing.writeText("MFSU Reaktor",{27,9},colors.orange)
  24. drawing.writeText("Energie:",{27,11},colors.white)
  25. drawing.writeText("Max.:",{27,12},colors.white)
  26.  
  27. drawing.update()
  28.  
  29. while true do
  30.   nir.find()
  31.  
  32.   local reactor = nir.sensors.right[1]
  33.   term.setCursorPos(12,4)
  34.   if reactor.enabled then
  35.     term.write("Online")
  36.   else
  37.     term.write("Offline")
  38.   end
  39.   term.setCursorPos(12,5)
  40.   term.write(string.format("%i",reactor.heat))
  41.   term.setCursorPos(12,6)
  42.   term.write(string.format("%i",reactor.maxHeat))
  43.   local hours = math.floor(reactor.timeLeft / 60 / 60)
  44.   local minutes = math.floor((reactor.timeLeft - hours * 60 * 60) / 60)
  45.   local seconds = reactor.timeLeft - hours * 60 * 60 - minutes * 60
  46.   term.setCursorPos(12,7)
  47.   term.write(hours .. "h " .. minutes .. "m " .. seconds .. "s")
  48.   term.setCursorPos(12,8)
  49.   term.write(string.format("%i",reactor.output))
  50.  
  51.   local nir2 = peripheral.wrap("right")
  52.   local uuid,state,title,mfsu1 = nir2.get(2)
  53.   term.setCursorPos(36,4)
  54.   term.write(string.format("%i",mfsu1.energyL))
  55.   term.setCursorPos(36,5)
  56.   term.write(string.format("%i",mfsu1.maxStorageL))
  57.  
  58.   local uuid,state,title,mfsu2 = nir2.get(3)
  59.   term.setCursorPos(36,11)
  60.   term.write(string.format("%i",mfsu2.energyL))
  61.   term.setCursorPos(36,12)
  62.   term.write(string.format("%i",mfsu2.maxStorageL))
  63.          
  64.   os.startTimer(1)
  65.   os.pullEvent("timer")
  66. end
  67. sync.restore()
Advertisement
Add Comment
Please, Sign In to add comment