Advertisement
RiseAboveHate

Siren_Server_1.14_BitNet_Tower

Nov 8th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. local statelist = {
  2.   ["top"] = rs.getInput("top"),
  3.   ["front"] = rs.getInput("front"),
  4.   ["left"] = rs.getInput("left"),
  5.   ["right"] = rs.getInput("right"),
  6.   ["back"] = rs.getInput("back"),
  7.   ["bottom"] = rs.getInput("bottom"),
  8. }
  9.  
  10. local modem = {peripheral.find("modem")}
  11. for i = 1, #modem do modem[i].open(rednet.CHANNEL_REPEAT) end
  12.  
  13. local tower = {peripheral.find("bitnet_tower", function(name, object) return object.isTowerComplete() end)}
  14.  
  15. if #modem == 0 and #tower == 0 then error("No modems/towers found.")
  16. else
  17.     print("Welcome To The Siren Server!!!!!\nThis Program programmed By Yossi Yuval\nFor I.D.F!\nThis system is still in Beta!\nThis will be tested by I.D.F\n")
  18. end
  19.  
  20. local repeated, msgID, timerID, myEvent = 0, {}, {}
  21.  
  22. print(#modem.." modem"..(#modem==1 and "" or "s").." found.")
  23. print(#tower.." tower"..(#tower==1 and "" or "s").." found.")
  24. print("0 messages repeated.")
  25.  
  26. while true do -- Start an endless loop
  27.   --os.pullEvent("redstone") -- Yield the computer until some redstone changes
  28.   -- We don't care what the event returns, since the first variable will be "redstone" and the rest will be nil.
  29.  
  30.   -- Now we check each side to see if it's changed.
  31.   --for side, state in pairs(statelist) do -- Run the lines of code in this loop for each key/value pair in statelist
  32.    -- if rs.getInput(side) ~= state then -- If the side we're checking doesn't match what it was last time we checked then
  33.         --statelist[side] = rs.getInput(side) -- Update the statelist with the new change
  34.         --resend("on")
  35.     --else
  36.         --resend("off")
  37.    -- end  
  38.   --end
  39.   os.pullEvent("redstone")
  40.     if rs.getInput("left") or rs.getInput("right") or rs.getInput("top") or rs.getInput("bottom") or rs.getInput("front") or rs.getInput("back") then
  41.         for i = 1, #modem do modem[i].transmit(rednet.CHANNEL_REPEAT, 163, "on") end
  42.     else
  43.         for i = 1, #modem do modem[i].transmit(rednet.CHANNEL_REPEAT, 163, "off") end
  44.     end  
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement