LaniusFNV

CC Base Monitor Client

Nov 22nd, 2020 (edited)
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | None | 0 0
  1. local modem = peripheral.wrap("bottom")
  2. local chest = peripheral.wrap("back")
  3.  
  4. local SERVER_CHANNEL = 1
  5.  
  6. local function sendItems(items)
  7.     modem.transmit(2, 1, items)
  8.     sleep(1)
  9. end
  10.  
  11. local function main()
  12.     while true do
  13.         local items = chest.list()
  14.  
  15.         local event, peripheral_name, channel, reply_channel, message, distance = os.pullEvent("modem_message")
  16.         if channel == SERVER_CHANNEL and message == "req items" then
  17.             sendItems(items)
  18.         end
  19.     end
  20. end
  21.  
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment