Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- VARIABLES
- modem = peripheral.wrap("back")
- furnaces = {}
- max_capacity = 0
- current_capacity = 0
- -- FETCH ALL FURNACE GENERATORS AND CAPACITY
- for key, value in pairs(modem.getNamesRemote()) do
- table.insert(furnaces, value)
- end
- max_capacity = table.getn(furnaces) * 64
- -- MAIN FUNCTION / FETCHING CAPACITY AT ALL TIME
- function main()
- for key, value in pairs(furnaces) do
- if modem.callRemote(value, "getStackInSlot", 1) then
- current_capacity = current_capacity + modem.callRemote(tostring(value), "getStackInSlot", 1)["qty"]
- end
- end
- print((current_capacity / max_capacity) * 100)
- current_capacity = 0
- os.sleep(1)
- main()
- end
- -- BREAKING FUNCTION
- function loop()
- while true do
- local _,key = os.pullEvent("key")
- if key == keys.q then
- break
- end
- end
- end
- parallel.waitForAny(main, loop)
- print("PROGRAM ENDED")
- -- .callRemote(string peripheral, string method, va_arg)
- -- .callRemote("generatorfurnace_N", "getStackInSlot", 1)["qty"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement