Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sides = { "left", "right", "top",
- "bottom", "front", "back" }
- local mon = peripheral.wrap("back")
- os.loadAPI("ProgressBar")
- ProgressBar.SetPeripheral("back")
- function checkIsSide(str)
- for i=1, #sides do
- if str == sides[i] then return true end
- end
- return false
- end
- while true do
- peripherals = peripheral.getNames()
- for i=1, #peripherals do
- if checkIsSide(peripherals[i]) == false then
- local name = peripherals[i]
- if ProgressBar[peripherals[i]] == nil then
- ProgressBar[peripherals[i]] = {}
- ProgressBar[peripherals[i]]["XMin"] = 27
- ProgressBar[peripherals[i]]["XMax"] = 47
- ProgressBar[peripherals[i]]["YVal"] = i
- end
- if string.find(peripherals[i], "tank") then
- tank = peripheral.wrap(peripherals[i])
- info = tank.getTankInfo("unknown")
- for u, v in pairs(info) do
- for column,data in pairs(v) do
- print(column..
- ": "..data)
- if column == "capacity" then
- ProgressBar[peripherals[i]]["Max"] = data
- elseif column == "amount" then
- ProgressBar[peripherals[i]["Current"] = data
- end
- end
- end
- end
- mon.setCursorPos(1, i)
- mon.write(name)
- ProgressBar.DrawToPeripheral()
- end
- end
- break
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement