Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- local sensor = peripheral.wrap("right")
- local mon = peripheral.wrap("top")
- mon.setTextColor(colors.green)
- mon.setBackgroundColor(colors.white)
- local targets = sensor.getTargets()
- local items = {}
- term.setTextColor(colors.white)
- local addItems = function(name, num)
- if items[name] ~= nil then
- items[name] = items[name] + num
- else
- items[name] = num
- end
- end
- for k, v in pairs(targets) do
- if k ~= "0,0,0" then
- local inv = sensor.getTargetDetails(k)["Slots"]
- for i, n in pairs(inv) do
- -- print(inv[i]["Name"] .. ": " .. inv[i]["Size"])
- addItems(inv[i]["Name"], inv[i]["Size"])
- end
- end
- end
- for k, v in pairs(items) do
- mon.write(k .. ": " .. v .. "")
- mon.write("test")
- local _, cY = mon.getCursorPos()
- mon.setCursorPos(1,cY+1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement