Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tank = peripheral.wrap("rcsteeltankvalvetile_0")
- bridge = peripheral.wrap("right")
- mc = 1
- --bridge.addText(1,1)
- local function opairs(_t)
- local keys = {}
- for k in pairs(_t) do
- table.insert(keys,k)
- end
- table.sort(keys)
- local index = 0
- return function()
- index = index + 1
- local key = keys[index]
- return key,_t[key]
- end
- end
- _tf = tank.getTankInfo("unknown")
- for x,y in pairs(_tf) do
- for x2,y2 in pairs(y) do
- if x2 == "rawName" then
- ntu = y2
- end
- if x2 == "amount" then
- amta = y2
- end
- if x2 == "capacity" and y2 ~= 20 then
- cpta = y2
- end
- end
- end
- perc = math.floor(amta / cpta * 100).."%"
- toadd = {
- ["name"]=ntu,
- ["amount"]=amta,
- ["capacity"]=cpta,
- ["percent"]=perc}
- for k,v in opairs(toadd) do
- bridge.addText(1,mc,k..": "..v,1160255)
- mc = mc + 8
- end
- --if cpta ~= nil and amta ~= nil then print(cpta..amta) end
Advertisement
Add Comment
Please, Sign In to add comment