Advertisement
Guest User

gpomon

a guest
Mar 31st, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. --set everything up. load APIs, wrap peripherals, set up variables
  2. os.loadAPI("lazy")
  3. glass = peripheral.wrap(lazy.find("openperipheral_bridge"))
  4. nuke = peripheral.wrap(lazy.find("BigReactors-Reactor"))
  5. local delay = 0.25 --so I don't have to scroll
  6. glass.getSurfaceByName("Basedsmz")
  7.  
  8. --colors
  9. white = 0xFFFFFF
  10. yellow = 0xFFFF00
  11. red = 0xFF0000
  12. cyan = 0x00FFFF
  13. grey = 0x1B1B1B
  14. opacity = 0.5
  15.  
  16.  
  17. --=====FUNCTIONS=====
  18. --meter - draw a horizontal level meter to screen
  19. --takes six arguments
  20. -- x: horizontal position, from top left
  21. -- y: vertical position from top left
  22. -- value: the part bit that gets filled in
  23. -- maxValue: the maximum amount of filled in bit
  24. -- fgColor: color for the "full" portion of the bar
  25. -- bgColor: color for the "empty" portion of the bar
  26. function meter(x,y,val,maxVal,fgColor,bgColor)
  27.   local valPercent = lazy.roundPercent(val,maxVal)
  28.   glass.addBox(x,y,100,8,bgColor,1)
  29.   glass.addBox(x,y,valPercent,8,fgColor,1)
  30. end
  31. --=====END=====
  32.  
  33. while true do
  34.   glass.clear()
  35.   --redraw the background box
  36.   glass.addBox(13,13,150,35,grey,opacity)
  37.   --draw the meters and info
  38.   meter(15,15,nuke.getFuelAmount(),nuke.getFuelAmountMax(),yellow,red) --draw the fuel bar
  39.   glass.addText(117,15,lazy.roundPercent(nuke.getFuelAmount(),nuke.getFuelAmountMax(),1).."%",white) --output the fuel amount
  40.   meter(15,26,nuke.getWasteAmount(),1000,cyan,yellow) --draw the waste bar
  41.   glass.addText(117,26,nuke.getWasteAmount().."mB",white)
  42.   --just text here
  43.   glass.addText(15,37,lazy.round(nuke.getEnergyProducedLastTick(),1).."RF/t",white)
  44.   glass.addText(117,37,lazy.round(nuke.getFuelTemperature(),1).."C",white)
  45.   glass.sync()
  46.   sleep(delay)
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement