Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local statelist = {
- ["top"] = rs.getInput("top"),
- ["front"] = rs.getInput("front"),
- ["left"] = rs.getInput("left"),
- ["right"] = rs.getInput("right"),
- ["back"] = rs.getInput("back"),
- ["bottom"] = rs.getInput("bottom"),
- }
- local modem = {peripheral.find("modem")}
- for i = 1, #modem do modem[i].open(rednet.CHANNEL_REPEAT) end
- local tower = {peripheral.find("bitnet_tower", function(name, object) return object.isTowerComplete() end)}
- if #modem == 0 and #tower == 0 then error("No modems/towers found.")
- else
- 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")
- end
- local repeated, msgID, timerID, myEvent = 0, {}, {}
- print(#modem.." modem"..(#modem==1 and "" or "s").." found.")
- print(#tower.." tower"..(#tower==1 and "" or "s").." found.")
- print("0 messages repeated.")
- while true do -- Start an endless loop
- os.pullEvent("redstone") -- Yield the computer until some redstone changes
- -- We don't care what the event returns, since the first variable will be "redstone" and the rest will be nil.
- -- Now we check each side to see if it's changed.
- for side, state in pairs(statelist) do -- Run the lines of code in this loop for each key/value pair in statelist
- if rs.getInput(side) ~= state then -- If the side we're checking doesn't match what it was last time we checked then
- statelist[side] = rs.getInput(side) -- Update the statelist with the new change
- tower[i].transmit("on")
- else
- tower[i].transmit("off")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement