Advertisement
RiseAboveHate

BitNet Repeater 1.15

Nov 14th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. local modem = {peripheral.find("modem")}
  2. for i = 1, #modem do modem[i].open(rednet.CHANNEL_REPEAT) end
  3.  
  4. local tower = {peripheral.find("bitnet_tower", function(name, object) return object.isTowerComplete() end)}
  5.  
  6. local repeated, msgID, timerID, myEvent = 0, {}, {}
  7.  
  8. local function RedstoneSetSignal(signal)
  9.  
  10.     if signal == "on" then
  11.         --for k,v in pairs(redstone.getSides()) do
  12.             --redstone.setOutput(v, true)
  13.         --end
  14.        
  15.         --print"Waiting for audio disk..."
  16.         --if then
  17.         --  if disk.hasAudio(side)
  18.         --      print("Disk Drive doesn't has the audio disk.\nPlease put in the '13' Song disk.")
  19.         --  else
  20.         --      disk.playAudio(side)
  21.         --   end
  22.         --end      
  23.        
  24.         if peripheral.isPresent("top") then
  25.        
  26.             if disk.hasAudio("top") then
  27.            
  28.                 disk.playAudio("top")
  29.                
  30.             else
  31.            
  32.                 print("Disk Drive doesn't has the audio disk.\nPlease put in the '13' Song disk.")
  33.                 os.reboot()
  34.            
  35.             end
  36.                
  37.         else
  38.              
  39.           error("No disk drive found on Top.\nPlease Place the disk drive on the top of the computer.")
  40.           os.reboot()
  41.          
  42.         end
  43.        
  44.     elseif signal == "off" then
  45.  
  46.         if peripheral.isPresent("top") then
  47.            
  48.             disk.stopAudio("top")
  49.                
  50.         else
  51.              
  52.           error("No disk drive found on Top.\nPlease Place the disk drive on the top of the computer.")
  53.          
  54.         end
  55.    
  56.     end
  57.  
  58. end
  59.  
  60. while #tower == 1 do
  61.  
  62.     myEvent = {os.pullEvent()}
  63.    
  64.     -- Message arriving via tower:
  65.     if myEvent[1] == "bitnet_message" then
  66.         print("Message: "..myEvent[3])
  67.         RedstoneSetSignal(myEvent[3])
  68.     end
  69.                
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement