Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local c1 = peripheral.wrap("diamond_0")
- local c2 = peripheral.wrap("diamond_1")
- local m = peripheral.wrap("front")
- local slots1 = c1.getInventorySize()
- local slots2 = c2.getInventorySize()
- --local stackSize1 = c1.getStackInSlot(1) --method call for stackSize#.maxSize var
- --local stackSize2 = c2.getStackInSlot(1)
- local maxItems1 = slots1 * 64
- local maxItems2 = slots2 * 64
- function checkMachines()
- term.setCursorPos(1, 3)
- term.write("------------------")
- if rs.getOutput("top") then
- machine = "Harvest"
- term.setCursorPos(1, 4)
- term.write(machine.." : Off")
- else
- machine = "Harvest"
- term.setCursorPos(1, 4)
- term.write(machine.." : On ")
- end
- if rs.getOutput("right") then
- machine = "Furnaces"
- term.setCursorPos(1, 5)
- term.write(machine..": Off")
- else
- machine = "Furnaces"
- term.setCursorPos(1, 5)
- term.write(machine..": On ")
- end
- end
- function clearScr(lines)
- clear = " "
- for i=1, lines do
- term.setCursorPos(1, i)
- term.write(clear)
- end
- --[[term.setCursorPos(1, 1) -- Block deprecated for efficiency, saved for debugging
- term.write(clear)
- term.setCursorPos(1, 2)
- term.write(clear)
- term.setCursorPos(1, 3)
- term.write(clear)]]--
- end
- function coalCount()
- c1.condenseItems()
- inv = c1.getAllStacks()
- qty = 0
- name = c1.getStackInSlot(1)
- if name == nil then
- nameAlt = "Charcoal"
- end
- for k, v in pairs(inv) do
- qty = qty + v.qty
- if qty >= maxItems1 - 1 then
- rs.setOutput("right", true)
- elseif qty == nil then
- qty = 0
- else
- rs.setOutput("right", false)
- end
- end
- term.setCursorPos(1, 1)
- term.write(name.name..":"..qty.."/"..maxItems1 or nameAlt..":"..qty.."/"..maxItems1)
- end
- function woodCount()
- c2.condenseItems()
- inv = c2.getAllStacks()
- qty = 0
- name = c2.getStackInSlot(2)
- if name == nil then
- nameAlt = "Oak Logs"
- end
- for k, v in pairs(inv) do
- qty = qty + v.qty
- if qty >= maxItems2 - 1 then
- rs.setOutput("top", true)
- elseif qty == nil then
- qty = 0
- else
- rs.setOutput("top", false)
- end
- end
- term.setCursorPos(1, 2)
- term.write(name.name..":"..qty.."/"..maxItems2 or nameAlt..":"..qty.."/"..maxItems2)
- end
- term.redirect(m)
- --term.setCursorPos(1, 5) --display debugging
- --term.write("debug")
- clearScr(5)
- while true do
- checkMachines()
- coalCount()
- woodCount()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement