Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sensor = peripheral.wrap("top")
- local items = {}
- local nItems = 0
- local x,pageSize = term.getSize()
- local pIndex = 1
- local range = 3
- local function getChest(name,data)
- local itemN = data.Name
- local count = data.Size
- local max = data.MaxStack
- if not items.itemN then
- items[itemN] = {
- count = 0,
- space = 0}
- end
- items[itemN].count = items[itemN].count + count
- items[itemN].space = items[itemN].space + max
- end
- local function getChests(name,data)
- local chest = sensor.getTargetDetails(name)
- if chest then
- local slots = chest.Slots
- if slots then
- table.foreach(slots,getChest)
- end
- end
- end
- function printInfo(name,data)
- if pIndex==pageSize then
- sleep(10)
- pIndex = 1
- end
- print(name," - ",data.count)
- pIndex = pIndex + 1
- end
- while true do
- local chests = sensor.getTargets()
- print("Finished getting targets...")
- table.foreach(chests,getChests)
- table.foreach(items,printInfo)
- sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement