Advertisement
JaMaNi133

Fluid bus rednet reciever

Oct 28th, 2023 (edited)
896
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.23 KB | None | 0 0
  1. --reciever
  2. local networkSide = "bottom"
  3. local bundleSide  = "top"
  4. local CA          = colors.white
  5. local GA          = colors.pink
  6. local CB          = colors.blue
  7. local GB          = colors.yellow
  8. local CC          = colors.red
  9. local GC          = colors.orange
  10.  
  11.  
  12. rednet.open(networkSide)
  13. print(string.format("Joined Rednet as %d",os.getComputerID()))
  14. while true do
  15.     local event, dist, message = os.pullEvent("rednet_message")
  16.     local redbus = 0
  17.     print(string.format("event: %s  msg: %s  dist: %d",event,message,dist))
  18.     if tonumber(message1) == 1024 then
  19.         shell.run("OS/update.lua")
  20.         shell.run("reboot")
  21.     end
  22.     if bit.band(tonumber(message),1) == 1 then
  23.         redbus = redbus + CA
  24.     end
  25.     if bit.band(tonumber(message),2) == 2 then
  26.         redbus = redbus + GA
  27.     end
  28.     if bit.band(tonumber(message),4) == 4 then
  29.         redbus = redbus + CB
  30.     end
  31.     if bit.band(tonumber(message),8) == 8 then
  32.         redbus = redbus + GB
  33.     end
  34.     if bit.band(tonumber(message),16) == 16 then
  35.         redbus = redbus + CC
  36.     end
  37.     if bit.band(tonumber(message),32) == 32 then
  38.         redbus = redbus + GC
  39.     end
  40.     redstone.setBundledOutput(bundleSide,redbus)
  41. end
  42.        
  43.    
  44.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement