Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enlim=8000000
- enmin=3000000
- function getEnSt()
- return re.getEnergyStored()--[[+enc.getEnergyStored()]]
- end
- function printStat()
- re=peripheral.wrap("BigReactors-Reactor_53")
- --enc=peripheral.wrap("tile_blockcapacitorbank_name_27")
- g=peripheral.wrap("right")
- if(re.getActive())then
- str = "An"
- else
- str = "Aus"
- end
- print("Terminal Reaktor:"..str)
- print("Energie: "..re.getEnergyProducedLastTick().." RF/t")
- print("Energie gespeichert: "..getEnSt().." RF")
- --print("An: "..re.getActive())
- print("Fuel: "..re.getFuelAmount().."/"..re.getFuelAmountMax())
- end
- function round(val,decs)
- local mult = 10^decs
- return math.floor(val*mult)/mult
- end
- function map(val,omax,nmax)
- return val/omax*nmax
- end
- function updGlasses()
- g.clear()
- if(re.getActive() and getEnSt()>enmin)then
- col=0x00FF00
- elseif(re.getActive() and getEnSt()<enmin) then
- col=0xFF0000
- else
- col=0xFF8800
- end
- h = 12
- g.addBox(1,h+1,100,10,0x000000,0.7)
- enst = getEnSt()
- enmax = 10000000--[[+enc.getMaxEnergyStored()]]
- g.addBox(1,h+1,map(enst,enmax,100),10,col,0.7)
- g.addBox(1+map(enmin,enmax,100),h+1,1,10,0x5555FF,0.7)
- g.addBox(1+map(enlim,enmax,100),h+1,1,10,0x5555FF,0.7)
- g.addText(1,h+14,round(enst/enmax*100,2).."%",0xFF5555)
- g.sync()
- end
- function checkreac()
- enst=getEnSt()
- if enst>=enlim then
- re.setActive(false)
- elseif enst<=enmin then
- re.setActive(true)
- end
- end
- while true do
- printStat()
- updGlasses()
- sleep(1)
- shell.run("clear")
- checkreac()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement