Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true do
- sleep(300)
- local mon = peripheral.wrap("monitor_61")
- local pylon = peripheral.wrap("draconic_rf_storage_5")
- monX, monY = mon.getSize()
- function clear()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- mon.setCursorPos(1,6)
- end
- function drawText(x, y, text, color_txt, color_bg)
- mon.setBackgroundColor(color_bg)
- mon.setTextColor(color_txt)
- mon.setCursorPos(x,y)
- mon.write(text)
- end
- function drawLine(x, y, length, size, color_bar)
- for yPos = y, y+size-1 do
- mon.setBackgroundColor(color_bar)
- mon.setCursorPos(x, yPos)
- mon.write(string.rep(" ", length))
- end
- end
- function drawProg(x, y, name, length, size, minVal, maxVal, color_bar, color_bg)
- drawLine(x, y, length, size, color_bg)
- local barSize = math.floor((minVal/maxVal)*length)
- drawLine(x, y, barSize, size, color_bar)
- local text = name.." "..math.floor((minVal/maxVal)*100).."%"
- if barSize > length/2+#text/2 then
- drawText(x+length/2-#text/2, y+size/2, text, colors.black, color_bar)
- elseif barSize > #text then
- drawText((x+barSize)-#text, y+size/2, text, colors.black, color_bar)
- else
- drawText(x+length/2-#text/2, y+size/2, text, colors.black, color_bg)
- end
- end
- drawProg(2,8, " ", 27, 3, pylon.getEnergyStored(), pylon.getMaxEnergyStored(), colors.lime, colors.gray)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement