Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --===== screen resolution =====
- local width = 50
- local height = 25
- --===== background ============
- local bg = 0x000000
- --===== border color ==========
- local brbg = 0x000000
- local brfg = 0xFFFFFF
- --===== text color =============
- local Tfg = 0xffffff
- --===== bar color ==============
- local Bbg = 0xff00f0
- local Bfg = 0x00ffff
- --========================================
- local eformat = {
- "Thousand",
- "Million",
- "Billions",
- "Trillion",
- "Quadrillion",
- "Quintillion",
- }
- local blocks = {
- ---------- ---------- ----------
- ------------- IC2 --------------
- {"mfsu","EU"},
- {"mfe","EU"},
- ----------- AFSU MOD -----------
- {"afsu","EU"},
- ----------- Mekanism -----------
- {"___________________________","RF"},
- {"____________________","RF"},
- ------- Matter Overdrive -------
- {"_________________________________","RF"},
- ------- Thermal Expansion ------
- {"tile_thermalexpansion_cell_resonant_name","RF"}
- ---------- ---------- ----------
- }
- local c = require "component"
- local g = c.gpu
- function bgreset()
- g.setBackground(bg)
- g.setForeground(Tfg)
- end
- function text(x,y,t)
- bgreset()
- g.set(x,y,t)
- end
- function energyFormat(i)
- i = tostring(i)
- local wordid = math.ceil(i:len() / 3)-1
- local word = ""
- if wordid>0 then
- word = eformat[wordid]
- end
- local t = string.sub(i,0,i:len()-(wordid*3))
- return t .. " " .. word
- end
- function bar(x,y,i,t)
- g.setBackground(Bbg)
- g.fill(x+8,y,width-11-x+2,1," ");
- g.setBackground(Bfg)
- g.fill(x+8,y,(((width-11-x+2)/100)*i),1," ");
- local c=0x000000
- if i<=25 then
- c=0xff0000
- elseif i<=50 then
- c=0xf05000
- elseif i<=75 then
- c=0xfff000
- elseif i<=100 then
- c=0x00ff00
- end
- text(x,y,t)
- g.setBackground(bg)
- g.setForeground(c)
- g.set(x+3,y,i.." ")
- g.set(x+6,y,"%")
- end
- function gui()
- bgreset()
- g.setResolution(width,height)
- g.setBackground(brbg)
- g.setForeground(brfg)
- c.gpu.fill(2,1,width-2,1,"═");
- c.gpu.fill(width,1,1,1,"╗");
- c.gpu.fill(width,2,1,height-2,"║");
- c.gpu.fill(width,height,1,1,"╝");
- c.gpu.fill(2,height,width-2,1,"═");
- c.gpu.fill(1,height,1,1,"╚");
- c.gpu.fill(1,2,1,height-2,"║");
- c.gpu.fill(1,1,1,1,"╔");
- c.gpu.fill(12,2,1,9,"║");
- c.gpu.fill(29,2,1,9,"║");
- c.gpu.fill(2,3,44,1,"═");
- c.gpu.fill(2,5,44,1,"═");
- c.gpu.fill(2,7,44,1,"═");
- c.gpu.fill(2,9,44,1,"═");
- c.gpu.fill(2,11,44,1,"═");
- c.gpu.fill(46,2,1,9,"║");
- text(46,11,"╝");
- text(29,7,"╬")
- text(29,5,"╬")
- text(29,3,"╬")
- text(29,9,"╬")
- text(12,7,"╬")
- text(12,5,"╬")
- text(12,9,"╬")
- text(12,3,"╬")
- text(12,1,"╦")
- text(46,1,"╦")
- text(29,1,"╦")
- text(12,11,"╩")
- text(29,11,"╩")
- text(46,9,"╣")
- text(46,7,"╣")
- text(46,5,"╣")
- text(46,3,"╣")
- text(14,2,"EU")
- text(31,2,"RF")
- text(3,2,"Type")
- text(3,4,"Blocks")
- text(3,6,"Energy")
- text(3,8,"Maximum")
- text(3,10,"Energy/s")
- text(width-30,height-1,"Created: StreamerYT (FYfSDrAD)")
- end
- for screen,n in c.list("screen") do
- screen = c.proxy(screen)
- g.bind(screen.address)
- g.fill(1,1,width,height," ");
- end
- local EU1 = 0
- local RF1 = 0
- function run()
- local EU = 0.0001
- local EUmax = 0.0001
- local EUs = 0
- local RF = 0.0001
- local RFmax = 0.0001
- local RFs = 0
- for i in pairs(blocks) do
- local block = blocks[i]
- for a, n in c.list(block[1]) do
- cmp = c.proxy(a)
- if block[2] == "RF" then
- RFs = RFs + 1
- RFmax = RFmax + cmp.getMaxEnergyStored()
- RF = RF + cmp.getEnergyStored()
- else
- EUs = EUs + 1
- EUmax = EUmax + cmp.getEUCapacity()
- EU = EU + cmp.getEUStored()
- end
- end
- end
- local EUp = math.floor((100 / EUmax) * EU)
- local EUsec = math.floor(EU - EU1)
- EU1 = EU
- for screen,n in c.list("screen") do
- screen = c.proxy(screen)
- g.bind(screen.address)
- text(14,4,EUs.." ")
- text(14,10,EUsec.." ")
- text(14,6,math.floor(EU).." ")
- text(14,8,math.floor(EUmax).." ")
- if EUs==0 then
- bar(3,height-5,0,"EU");
- else
- bar(3,height-5,EUp,"EU");
- end
- local RFp = math.floor((100 / RFmax) * RF)
- local RFsec = math.floor(RF - RF1)
- RF1 = RF
- text(31,4,RFs.." ")
- text(31,10,RFsec.." ")
- text(31,6,math.floor(RF).." ")
- text(31,8,math.floor(RFmax).." ")
- if RFs==0 then
- bar(3,height-3,0,"RF")
- else
- bar(3,height-3,RFp,"RF")
- end
- gui()
- end
- end
- function test()
- run()
- os.sleep(0.1)
- end
- function start()
- while true do
- run()
- os.sleep(1)
- end
- end
- start()
Add Comment
Please, Sign In to add comment