Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("right")
- local ec = peripheral.wrap("bottom")
- local monScale = 0.5
- mon.setTextScale(monScale)
- mon.setBackgroundColor(colors.black)
- mon.clear()
- local w,h = mon.getSize()
- w = math.floor(w / 2)
- print(w," ",h)
- local col3 = {colors.red, colors.yellow, colors.green}
- local col5 = {colors.red, colors.orange, colors.yellow, colors.lime, colors.green}
- local col, ncol, n
- if w % 3 < w % 5 then
- col = col3
- ncol = 3
- w = w - (w % 3)
- else
- col = col5
- ncol = 5
- w = w - (w % 5)
- end
- n = w / ncol
- local eNow, eMax, wOld, wNew
- wNew = w
- local start = true
- while true do
- wOld = wNew
- eNow = ec.getEnergyStored("right")
- eMax = ec.getMaxEnergyStored("right")
- wNew = math.ceil(w * eNow / eMax)
- if wOld ~= wNew or start then
- start = false
- mon.setBackgroundColor(colors.black)
- mon.clear()
- for i = 1,wNew do
- for j = 1,h do
- mon.setCursorPos(i*2 - 1,j)
- mon.setBackgroundColor(col[math.ceil(i/n)])
- mon.write(" ")
- mon.setCursorPos(i*2,j)
- mon.setBackgroundColor(colors.black)
- mon.write(" ")
- end
- end
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement