Advertisement
Scarjit

Untitled

Mar 19th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. local reaktor = peripheral.wrap("back")
  2. local chest = peripheral.wrap('chest_1')
  3. local cell = peripheral.wrap('tile_thermalexpansion_cell_resonant_name_0')
  4. local g = peripheral.wrap("right")
  5.  
  6. function addBg()
  7. g.addBox(1,1,200,80,0xFFFFFF,0.2)
  8. end
  9.  
  10. function write()
  11. local energyMax = cell.getMaxEnergyStored()
  12. local energyStored = cell.getEnergyStored()
  13.  
  14. g.addText(3,2,"Generated Rf/t: "..tostring(reaktor.getEnergyProducedLastTick()),0x000000)
  15. g.addText(3,12,"Control Rod Level: "..tostring(reaktor.getControlRodLevel(1)),0x000000)
  16. g.addText(3,22,"Reactor Status: ", 0x000000)
  17. if reaktor.getActive() then
  18. g.addText(85,22,"Online",0x00FF00)
  19. else
  20. g.addText(85,22,"Offline",0xFF0000)
  21. end
  22. g.addText(3,32,"Energy Stored: "..((energyStored/energyMax)*100).."%",0x000000)
  23. g.addText(3,42,"Fuel left: "..tostring(reaktor.getFuelAmount()+GetItemsInChest()*1000).."mB",0x000000)
  24. g.addText(3,52,"mB/t: "..tostring(reaktor.getFuelConsumedLastTick()),0x000000)
  25.  
  26. local fuelticksleft = ((reaktor.getFuelAmount()+GetItemsInChest()*100)/reaktor.getFuelConsumedLastTick())
  27. local secleft = fuelticksleft/20
  28. local minleft = secleft/60
  29. local hourleft = minleft/60
  30. local daysleft = hourleft/24
  31.  
  32. if daysleft > 1 then
  33. g.addText(3,62,"Time left: "..tostring(daysleft).." Days",0x000000)
  34. elseif hourleft > 1 then
  35. g.addText(3,62,"Time left: "..tostring(hourleft).." Hours",0x000000)
  36. elseif minleft > 1 then
  37. g.addText(3,62,"Time left: "..tostring(minleft).." Minutes",0x000000)
  38. elseif secleft > 1 then
  39. g.addText(3,62,"Time left: "..tostring(secleft).." Seconds",0x000000)
  40. elseif fuelticksleft > 1 then
  41. g.addText(3,62,"Time left: "..tostring(fuelticksleft).." Ticks",0x000000)
  42. else
  43. g.addText(3,62," -- FUEL DEPLETED -- ",0xFF0000)
  44. end
  45. end
  46.  
  47.  
  48.  
  49. function GetItemsInChest()
  50. local yellorium = 0
  51. for i = 1, chest.getInventorySize() do
  52. local s = chest.getStackInSlot(i)
  53. if s then
  54. if s.display_name == "Yellorium Block" then
  55. yellorium = yellorium + s.qty*9
  56. elseif s.display_name == "Yellorium Ingot" or s.display_name == "Blutonium Ingot" then
  57. yellorium = yellorium + s.qty
  58. end
  59. end
  60. end
  61. return yellorium
  62. end
  63.  
  64. function start()
  65. while true do
  66. g.clear()
  67. addBg()
  68. write()
  69. g.sync()
  70. sleep(1)
  71. end
  72. end
  73. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement