Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- mon = peripheral.find("monitor")
- input = "front"
- output = "back"
- --narc = peripheral.find("turtle")
- rs.setOutput(input,false)
- rs.setOutput(output,false)
- local function getItems()
- rs.setOutput(input,true)
- sleep(2)
- rs.setOutput(input,false)
- end
- local function flushItems()
- rs.setOutput(output,true)
- sleep(2)
- rs.setOutput(output,false)
- end
- local nItems = {}
- local function getTime()
- return os.day() * 24 + os.time()
- end
- local start = getTime()
- local now = start + 0.001
- -- changes for Direwolf20 and MC 1.7.10
- local function countItems()
- now = getTime()
- local item = nil
- --local items = {}
- for i = 1,16 do
- item = turtle.getItemDetail(i)
- if item then
- --items[#items+1] = item
- nItems[item.name] = nItems[item.name] and nItems[item.name]+item.count or item.count
- end
- item = nil
- end
- end
- local function countItems164()
- now = getTime()
- local items=narc.getAllStacks()
- for i,item in pairs(items) do
- nItems[item.name] = nItems[item.name] and nItems[item.name]+item.qty or item.qty
- end
- end
- local function displayCount()
- if not mon then return 0 end
- local monX,monY = mon.getSize()
- local line = 1
- mon.clear()
- for name,qty in pairs(nItems) do
- mon.setCursorPos(1,line)
- mon.write(name)
- mon.setCursorPos(monX - 5,line)
- mon.write(qty)
- line = line + 1
- end
- end
- local function displayRate()
- if not mon then return 0 end
- local monX,monY = mon.getSize()
- local line = 1
- mon.clear()
- for name,qty in pairs(nItems) do
- mon.setCursorPos(1,line)
- mon.write(name)
- mon.setCursorPos(monX - 5,line)
- mon.write(qty / (now - start))
- line = line + 1
- end
- end
- while true do
- getItems()
- countItems()
- flushItems()
- displayRate()
- --sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment