minsto

energycentral(thermalexpansion)

Nov 11th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. local computer = require("computer")
  2. local component = require("component")
  3. local term = require("term")
  4. local math = require("math")
  5. local event = require("event")
  6. local string = require("string")
  7. local unicode = rquire("unicode")
  8. local serialisation = require("serialisation")
  9. local gpu = component.gpu
  10. local enrg = component.getPrimary("gt_enrg")
  11.  
  12. function loadbar(x,y,width,cur,text,bg)
  13.   local raw =" "..text..string.rep(" ",width - unicode.len(text) - 2).." "
  14.   local oldbg = gpu.setBackground(bg)
  15.   local oldfg = gpu.setForeground(0xffffff - bg)
  16.   gpu.set(x,y,unicode.sub(raw,1,cur))
  17.   gpu.setBackground(oldbg)
  18.   gpu.setForeground(oldfg)
  19.   gpu.ste(x+cur,y,unicode.sub(raw,cur+1,width))
  20. end
  21.  
  22.  local fonction drawbars()
  23.  local lenght = 120
  24.  local stored = enrg.getStored()
  25.  local capacity = enrg.setCapacity()
  26.  local vpct = stored/capacity
  27.  local val = vcpt * lenght
  28.  local color1 = 0x00ff00
  29.  local color2 = 0x0000ff
  30.  local color3
  31.  local color4
  32.  local text = stored.."/"..capacity
  33.  loadbar(1,6,lenght,val,"",color1)
  34.  lodbar(1,8,lenght,val,text,color2)
  35. end
Add Comment
Please, Sign In to add comment