Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local term = require("term")
- local gpu = component.gpu
- local boule = component.draconic_rf_storage
- local reactor = component.br_reactor
- local function info()
- info0 = boule.getTransferPerTick()
- info1 = boule.getMaxEnergyStored()
- info2 = boule.getEnergyStored()
- info3 = reactor.getEnergyProducedLastTick()
- info4 = info2/info1*100
- end
- local function miseEnPage()
- kTra = (info0/1000)
- Tmen = (info1/1000000000000000000)
- Ten = (info2/1000000000000000000)
- kprod = (info3/1000)
- end
- local function affiche()
- gpu.setBackground(0xffffff)
- gpu.setForeground(0x023f63)
- gpu.set(2,4,string.format("Production reactor : %2.2f kRF/t",kprod))
- gpu.set(2,8,string.format("Max energie stocké : %1.2f ERF",Tmen))
- gpu.set(2,12,string.format("Energie stocké : %1.2f ERF",Ten))
- gpu.set(2,16,string.format("Energy en pct : %3.2f",info4).." %")
- gpu.set(2,21,string.format("Transfer energy boule : %2.2f kRF/t",kTra))
- local fond_barre = 0xdcdcdc
- local barre = 0x21af0e
- if info4 <= 50 then barre = 0xc81515 else barre = 0x21af0e end
- bar_h(5,18,38,info4,2,barre,fond_barre)
- gpu.setBackground(0x000000)
- gpu.setForeground(0xffffff)
- end
- function bar_h(bar_x,bar_y,bar_l,pos,ep,color,fond) -- barre horizontal syntax: bar_h(<pos colone>,<pos ligne>,<longueur>,<info>,<epaisseur de barre>,<couleur>,<fond>)
- local m = (bar_l/100)
- local f = math.floor(pos*m)
- gpu.setBackground(color)
- gpu.fill(bar_x,bar_y,f,ep," ")
- gpu.setBackground(fond)
- gpu.fill((bar_x+f),bar_y,(bar_l-f),ep," ")
- end
- term.clear()
- while true do
- info()
- miseEnPage()
- affiche()
- if
- info4 < 25
- then
- reactor.setActive(true)
- elseif
- info4 > 75
- then
- reactor.setActive(false)
- end
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement