Advertisement
maxthewell

invClient.lua

Aug 22nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.87 KB | None | 0 0
  1. os.loadAPI("lib/net.lua")
  2.  
  3. PROTO = "INV"
  4. HOST = "inv-mgmt-01"
  5. MSG = "get"
  6. OUTPUT_SIDE = "left"
  7. SERVER_ID = nil
  8.  
  9. COLORS = {
  10.     colors.white, colors.orange, colors.magenta, colors.lightBlue,
  11.     colors.yellow, colors.lime, colors.pink, colors.gray,
  12.     colors.lightGray, colors.cyan, colors.purple, colors.blue,
  13.     colors.brown, colors.green, colors.red, colors.black,
  14. }
  15.  
  16. function getSignals()
  17.     if SERVER_ID == nil then
  18.         SERVER_ID = net.getID(HOST, PROTO)
  19.     end
  20.     rednet.send(SERVER_ID, MSG, PROTO)
  21.     local _, signals = net.listen(PROTO, SERVER_ID)
  22.     return signals
  23. end
  24.  
  25. function outputSignals(signals)
  26.     rs.setBundledOutput(OUTPUT_SIDE, signals)
  27. end
  28.  
  29. function run()
  30.     print("initiating inventory client...")
  31.     while(true) do
  32.         local signals = getSignals()
  33.         outputSignals(signals)
  34.         os.sleep(10)
  35.     end
  36. end
  37.  
  38. run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement