Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- local reactor = peripheral.find("BigReactors-Reactor")
- local rodSize = 4
- function clear()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1,1)
- end
- function drawRods(sx, sy)
- local controlRods = reactor.getNumberOfControlRods()
- for i=1,controlRods do
- term.setCursorPos(1,1)
- local percent = reactor.getControlRodLevel(i-1)/100.0
- local h = math.floor(percent*rodSize)
- if percent == 1 then
- h = rodSize-1
- end
- local left = (rodSize-h)-1
- local x = sx+i*2
- local y = sy
- if i > 10 then
- y = y + rodSize+1
- x = sx + (i-10)*2
- end
- --write(tostring(i)..' '..tostring(h))
- --x,y,width,height
- paintutils.drawFilledBox(x, y, x, y+h, colours.green)
- if percent < 1 then
- paintutils.drawFilledBox(x, y+h, x, (y+h)+left, colours.red)
- end
- end
- term.setBackgroundColor(colours.black)
- end
- function drawHeader()
- local activeText = "Active"
- if not reactor.getActive() then
- activeText = "Disabled"
- end
- write("Reactor"..activeText.."\n")
- end
- term.redirect(monitor)
- monitor.setTextScale(0.5)
- while true do
- clear()
- drawHeader()
- drawRods(1, 4)
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement