Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Nuclear Waste Depot --
- gpu1 = computer.getGPUs(1)[1]
- NDisplay = component.proxy("E0ABBDA54599F50C06DB8DAD5E2F875F")
- gpu1:bindScreen(NDisplay)
- gpu1:setsize(35,10)
- gpu1:setForeground(1,1,1,1)
- gpu1:setBackground(0,0,0,0)
- -- DATA --
- local pw = 0 -- percentage space left
- local ws = 0 -- total number waste
- local ns = 48 -- Slotsize Container
- local was = 500 -- Stacksize
- local x = 108 -- number of containers
- local wc = (x * was * ns) -- max Capacity
- wc = math.floor(wc)
- -- bar colors --
- function barcolor()
- if pw <= 55 then gpu1:setBackground(0,255,0,0.5)
- end
- if pw > 55 and pw < 70 then gpu1:setBackground(255,120,0,1)
- end
- if pw >= 79 then gpu1:setBackground(255,0,0,1)
- else
- end
- end
- function getdata()
- ws = 0
- storagesum = component.proxy(component.findComponent("NuclearWasteStorage"))
- for _,m in ipairs(storagesum) do
- ws = ws + m:getInventories()[1].ItemCount
- end
- pw = (100 / wc) * ws
- pw = math.floor(pw)
- end
- -- display results --
- while true do
- event.pull(30)
- gpu1:fill(0,0,35,10," ")
- getdata()
- cap = wc / 1000
- cap = math.floor(cap)
- usd = ws / 1000
- usd = math.floor(usd)
- gpu1:setForeground(255,165,0,1)
- gpu1:setText(1,1,"N U C L E A R W A S T E")
- gpu1:setForeground(1,1,1,1)
- gpu1:setText(1,3,"CAPACITY: "..cap.." K")
- gpu1:setText(1,5,"USED: "..usd.." K")
- gpu1:setText(1,7,"PERC: "..pw.."%")
- gpu1:setText(14,7,"|")
- gpu1:setText(25,7,"|")
- barcolor()
- pw = pw / 10
- pw = math.floor(pw)
- gpu1:fill(15,7,pw,1," ") -- Balken Display
- gpu1:setBackground(0,0,0,0)
- gpu1:flush()
- end
Add Comment
Please, Sign In to add comment