Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local gpu = component.gpu
- local term = require("term")
- local energyCore = component.draconic_rf_storage
- local maxEnergy = energyCore.getMaxEnergyStored()
- local function niveau()
- production = energyCore.getTransferPerTick()
- energy = energyCore.getEnergyStored()
- pct = (energy * 100) / maxEnergy
- end
- local function miseEnPage() -- Valeur en gRf
- ken = (energy/1000000000000)
- kprod = (production/1000000000)
- end
- local function affiche() -- Valeurs Bruts
- gpu.setBackground(0xffffff)
- gpu.setForeground(0x023f63)
- gpu.set(5,5,"Production :"..production.." RF/t")
- gpu.set(5,6,"Energie :"..energy.." RF")
- gpu.set(5,7,"Energy en pct :"..pct.." %")
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- end
- local function affiche2() -- Valeurs Final
- gpu.setBackground(0xffffff)
- gpu.setForeground(0x000000)
- gpu.set(5,13,string.format("Production : %2.2f gRF/t",kprod))
- gpu.set(5,14,string.format("Energie : %5.2f tRF",ken))
- gpu.set(5,15,string.format("Energy en pct : %3.2f",pct).." %")
- local fond_barre = 0xdcdcdc
- local barre = 0x21af0e
- if pct <= 50 then barre = 0xc81515 else barre = 0x21af0e end
- bar_h(5,17,38,pct,2,barre,fond_barre)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- end
- local function bloc(a,b,l,h,titre,couleur) -- Bloc syntax
- gpu.setBackground(couleur)
- gpu.setForeground(0xffffff)
- gpu.fill(a,b,l,1," ") -- Barre de titre
- gpu.set((a+1),b,titre) -- Affichage du titre
- gpu.setBackground(0xffffff)
- gpu.fill(a,(b+1),l,h," ") -- Font de boite
- end
- function bar_h(bar_x,bar_y,bar_l,pos,ep,color,fond) -- Barre horizontal syntax
- local m = (bar_l/100) -- Rapport pct / position
- local f = math.floor(pos*m) -- Calcul de la valeur de position ou f = valeur de barre
- gpu.setBackground(color) -- Couleur barre
- gpu.fill(bar_x,bar_y,f,ep," ") -- Barre progressive
- gpu.setBackground(fond) -- Couleur font de barre
- gpu.fill((bar_x+f),bar_y,(bar_l-f),ep," ") -- Font de barre
- end
- --gpu.setBackground(0xf0f0f0)
- --gpu.setForeground(0x222222) -- Indication des valeurs de test
- --gpu.set(bar_x,(bar_y+1+ep),titre.." :"..string.format(" %3.2f",pos))
- -- end
- term.clear()
- bloc(4,3,40,5,"Valeurs Brut",0x023f63) -- Bloc d'affichage
- bloc(4,11,40,8,"Valeurs Formatés",0xe9e300)
- while true do -- Boucle infinie
- niveau() -- Valeurs boule draco
- miseEnPage()
- affiche()
- affiche2()
- os.sleep(1) -- Pause d'une seconde
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement