Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------------
- -- Программа График для Storage drawers --
- -- для компьютеров из мода OpenComputers --
- -- проект http://computercraft.ru --
- -- Version 0.1 --
- -- 2018, © Asior --
- -------------------------------------------------------
- local c = require("component")
- local drawer = nil
- if component.isAvailable("drawer") then
- drawer = c.drawer
- else
- print('Подключите адаптер к бочке!')
- os.exit()
- end
- local term = require("term")
- local gpu = c.gpu
- local charts = require("charts")
- gpu.setResolution(50, 16)
- local container = charts.Container()
- local payload = charts.Histogram()
- payload.max = drawer.getMaxCapacity(1)
- payload.min = 0
- payload.align = charts.sides.RIGHT
- container.x = 1
- container.y = 3
- container.width = 50
- container.height = 14
- payload.colorFunc = function(index, norm, value, self, container)
- return 0x20ff20
- end
- container.payload = payload
- local name = ''
- local count = -1
- while true do
- if count ~= drawer.getItemCount(1) then
- count = drawer.getItemCount(1)
- term.clear()
- if drawer.getStackInSlot(2) then
- name = drawer.getStackInSlot(2).display_name
- else
- name = 'Пустота'
- end
- gpu.set(1,1,'Хранится: '..name)
- gpu.set(1,2,'Объем: '..drawer.getItemCount(1)..'/'..drawer.getMaxCapacity(1))
- table.insert(payload.values, drawer.getItemCount(1))
- container:draw()
- end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement