Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. local reactor = peripheral.find("BigReactors-Reactor")
  2.  
  3. local turnOnAt = 20
  4. local turnOffAt = 90
  5.  
  6. local localEnergy = 0
  7. local status = false
  8. local energyLastTick = 0
  9.  
  10. function main()
  11.  
  12. drawScreen()
  13.  
  14. end
  15.  
  16.  
  17. function getValues()
  18. status = reactor.getActive()
  19. localEnergy = reactor.getEnergyStored()
  20. energyLastTick = reactor.getEnergyProducedLastTick()
  21.  
  22.  
  23. end
  24.  
  25. function drawScreen()
  26. monitor.clear()
  27. monitor.setTextScale(1)
  28. monitor.setBackgroundColor(colors.black)
  29. drawBox(1,39,1,3,colors.red,"Reactor Control",colors.white)
  30. drawBox(1,39,4,4,colors.black," ", colors.black)
  31. drawBox(1,19,5,5,colors.red,"Status",colors.white)
  32. drawBox(26,39,5,5,colors.black,tostring(status), colors.lime)
  33.  
  34. drawBox(1,39,6,6,colors.black," ", colors.black)
  35. drawBox(1,19,7,7,colors.red,"EnergyStored",colors.white)
  36. drawBox(26,39,7,7,colors.black,tostring(localEnergy), colors.lime)
  37.  
  38. drawBox(1,39,8,8,colors.black," ", colors.black)
  39. drawBox(1,19,9,9,colors.red,"Energy Production",colors.white)
  40. drawBox(26,39,9,9,colors.black,tostring(energyLastTick), colors.lime)
  41.  
  42. end
  43.  
  44.  
  45. function drawBox(xa,xb,ya,yb, bgcolor,text,textcolor)
  46. monitor.setCursorPos(xa,ya)
  47. monitor.setTextColor(textcolor)
  48. for y = ya,yb,1 do
  49.  
  50. for x = xa,xb,1 do
  51. monitor.setCursorPos(x,y)
  52. monitor.setBackgroundColor(bgcolor)
  53. monitor.write(" ")
  54. end
  55.  
  56.  
  57. xPos =1+ math.floor ((xa-1+xb) /2) - math.floor( string.len(text)/2 )
  58. monitor.setCursorPos(xPos,(ya+yb)/2)
  59. monitor.write(text)
  60.  
  61. end
  62. monitor.setCursorPos(xa,yb+1)
  63. monitor.setBackgroundColor(colors.black)
  64. monitor.write(" ")
  65. end
  66.  
  67. while true do
  68. main()
  69. sleep(1)
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement