Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function Abreger(nb, idp)
- if nb >= 1000000000000000000000000 then
- nb = nb / 1000000000000000000000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."Y")
- elseif nb >= 1000000000000000000000 then
- nb = nb / 1000000000000000000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."Z")
- elseif nb >= 1000000000000000000 then
- nb = nb / 1000000000000000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."E")
- elseif nb >= 1000000000000000 then
- nb = nb / 1000000000000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."P")
- elseif nb >= 1000000000000 then
- nb = nb / 1000000000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."T")
- elseif nb >= 1000000000 then
- nb = nb / 1000000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."G")
- elseif nb >= 1000000 then
- nb = nb / 1000000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."M")
- elseif nb >= 1000 then
- nb = nb / 1000
- mult = 10^ (idp or 0)
- nb = math.floor(nb * mult + 0.5) / mult
- return (nb.."K")
- else
- return nb
- end
- end
- function entier(nb)
- nb1 = math.floor(nb)
- nb2 = nb - nb1
- if nb2 >= 0.5 then
- return math.ceil(nb)
- else
- return nb1
- end
- end
- side = "top", "bottom", "back", "front", "right", "left"
- mon = peripheral.wrap(side)
- term.redirect(mon)
- typePeripheralReacteur = "BigReactors-Reactor_"
- nbTypePeripheralReacteur = 0
- echelle = 0
- xx, y = term.getSize()
- paintutils.drawFilledBox(1, 1, xx, y, colors.black)
- Clear()
- xGraph = 6
- yGraph = 0
- term.setTextColor(colors.white)
- paintutils.drawFilledBox(1, 1, xx, y, colors.black)
- Clear()
- tour = 0
- for tour=1,30 do
- reac = peripheral.wrap(typePeripheralReacteur..nbTypePeripheralReacteur)
- if reac ~= nil then
- energyProd = entier(reac.getEnergyProducedLastTick())
- nbTypePeripheralReacteur = 0
- else
- nbTypePeripheralReacteur = nbTypePeripheralReacteur + 1
- end
- sleep(0.5)
- end
- echelle = tonumber(energyProd + 200)
- while true do
- xx, y = term.getSize()
- paintutils.drawFilledBox(1, 1, 6, y, colors.black)
- term.setCursorPos(1,3)
- print(Abreger(echelle, 1))
- term.setCursorPos(3,y)
- print("0")
- paintutils.drawLine(6, y, 6, 1, colors.gray)
- while true do
- reac = peripheral.wrap(typePeripheralReacteur..nbTypePeripheralReacteur)
- if reac ~= nil then
- energyProd = entier(reac.getEnergyProducedLastTick())
- nbTypePeripheralReacteur = 0
- break
- else
- nbTypePeripheralReacteur = nbTypePeripheralReacteur + 1
- end
- end
- pourcent = entier(energyProd / echelle * y)
- xGraph = xGraph + 1
- yGraph = y - pourcent
- if yGraph < 1 then
- yGraph = 1
- end
- if yGraph < y / 4 then
- color = colors.green
- elseif yGraph < y / 2 then
- color = colors.yellow
- elseif yGraph < y / 4 * 3 then
- color = colors.orange
- else
- color = colors.red
- end
- if xGraph > xx then
- paintutils.drawFilledBox(7, 1, xx, y, colors.black)
- xGraph = 7
- end
- paintutils.drawLine(xGraph, yGraph, xGraph, y, color)
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment