Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("left")
- rednet.open("left")
- pd = peripheral.find("playerDetector")
- if pd == nil then error("playerDetector not found") end
- if rednet.isOpen() then
- print("Rednet online")
- else
- print("Rednet failed to load")
- return
- end
- function rednetMsgs()
- while true do
- local id, msg = rednet.receive()
- if id == 2 or id == 4 or id == 10 then
- if msg == "windmill" then
- if redstone.getOutput("top") then
- redstone.setOutput("top", false)
- else
- redstone.setOutput("top", true)
- end
- end
- end
- end
- end
- function playerFind()
- while true do
- local plys = pd.getPlayersInRange(3)
- if redstone.getOutput("top") then
- if #plys == 0 then
- redstone.setOutput("top", false)
- end
- end
- sleep(1)
- end
- end
- parallel.waitForAll(rednetMsgs,playerFind)
Advertisement
Add Comment
Please, Sign In to add comment