Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local name = "" --> What should this computer be called ex: Farm, mob spawner, etc.
- local updatetime = 60 --> How long (in seconds) to wait before requesting an update
- local modem = "right" --> set this to the side the modem is on
- local sides = { --> Modify this list to include sides you want to output redstone on
- "top",
- "front",
- "left",
- "right",
- "back",
- "bottom",
- }
- function disable()
- for i in pairs(sides) do
- redstone.setOutput(sides[i], false)
- end
- end
- function enable()
- for i in pairs(sides) do
- redstone.setOutput(sides[i], true)
- end
- end
- function processResponse(response)
- if response == "offline" then
- disable()
- elseif response == "online" then
- enable()
- end
- end
- function requestUpdate()
- serverID = rednet.lookup("AceDetectionCom", "OnlineDetectionServer")
- rednet.send(serverID, name, "update")
- end
- rednet.open(modem)
- while true do
- requestUpdate()
- senderId, message, protocol = rednet.receive("response", 10)
- if senderId ~= nil then
- print("Response received, status is: "..message)
- processResponse(message)
- else
- print("No response.")
- end
- sleep(updatetime)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement