Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local gpu = component.gpu
- local term = require("term")
- local storage = component.draconic_rf_storage
- local stored = storage.getEnergyStored --ПОЛУЧАЕМ ЗАПОЛНЕНОСТЬ ХРАНИЛИЩА
- local max = storage.getMaxEnergyStored --ПОЛУЧАЕМ ЁМКОСТЬ ХРАНИЛИЩА
- gpu.setBackground(0x202020)
- gpu.setForeground(0xFFDD00)
- term.clear()
- gpu.setResolution(40,6)
- --===================РИСУЕМ РАМКУ И ПИШЕМ ТЕКСТ================
- gpu.set(12,1,"Energy Storage")
- gpu.set(1, 2, " ┌────────────────────────────────────┐ ")
- gpu.set(1, 3, " │") gpu.set(39,3, "│")
- gpu.set(1, 4, " └────────────────────────────────────┘ ")
- while true do
- local procent = "Накоплено энергии: " .. math.ceil(stored()/max()*100) .. "%" --ТЕКСТ И ЗАПОЛНЕНОСТЬ В ПРОЦЕНТАХ
- local progress = math.ceil(stored()/max()*32) -- ЗНАЧЕНИЕ ШИРИНЫ ДЛЯ ОТРИСОВКИ ШКАЛЫ
- local details = math.ceil( stored()/1) .. "RF из " .. math.ceil( max()/1) .. "RF" --ТОЧНОЕ ЗНАЧЕНИЕ ХРАНИЛИЩА
- gpu.set(5,37-string.len(details),details) --ПИШЕМ ТОЧНУЮ ЗАПОЛНЕНОСТЬ
- gpu.set(11-string.len( math.ceil( stored()/max()*100 )),6,procent) --ПИШЕМ ЗАПОЛНЕНОСТЬ В ПРОЦЕНТАХ
- --=================РИСУЕМС ШКАЛУ===============
- local x = 4
- for i = 1, progress do
- gpu.set(x,3,"▒")
- x = x + 1
- end
- os.sleep(0.1) --ЖДЕМ 0.1 СЕКУНДУ
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement