Advertisement
RiseAboveHate

Siren_Server_1.13_BitNet_Tower

Nov 8th, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 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 towert = {peripheral.find("bitnet_towert", function(name, object) return object.istowertComplete() end)}
  14.  
  15. if #modem == 0 and #towert == 0 then error("No modems/towerts 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. while true do -- Start an endless loop
  21.   os.pullEvent("redstone") -- Yield the computer until some redstone changes
  22.   -- We don't care what the event returns, since the first variable will be "redstone" and the rest will be nil.
  23.  
  24.   -- Now we check each side to see if it's changed.
  25.   for side, state in pairs(statelist) do -- Run the lines of code in this loop for each key/value pair in statelist
  26.     if rs.getInput(side) ~= state then -- If the side we're checking doesn't match what it was last time we checked then
  27.       statelist[side] = rs.getInput(side) -- Update the statelist with the new change
  28.       for i = 1, #towert do towert[i].transmit("off") end
  29.     else
  30.         for i = 1, #towert do towert[i].transmit("on") end
  31.     end
  32.   end
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement