Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --main door host V2
- local rChannel=102
- local hChannel=103
- local osName=door
- local change=0
- local x,y,z=gps.locate()
- modem=peripheral.wrap("back")
- modem.open(rChannel)
- modem.open(hChannel)
- print("modem status:",modem.isOpen(rChannel))
- print("modem status:",modem.isOpen(hChannel))
- while true do
- local event, osef, osef, osef, recieved, osef = os.pullEvent("modem_message")
- command=textutils.unserialize(recieved)
- command.cy=command.cy-69
- if command~=#table then
- if command.cx==nil or command.cy==nil or command.cz==nil then
- print("nil")
- else
- if command.cx>=-4 and command.cx<=10 and command.cy>=60 and command.cy<=67 and command.cz>=119 and command.cz<=142 then
- if command.cx>=-1 and command.cx<=7 and command.cy>=60 and command.cy<=67 and command.cz>=129 and command.cz<=132 then
- print("-----------------------")
- redstone.setOutput("top",true)
- redstone.setOutput("front",true)
- sleep(1)
- redstone.setOutput("front",false)
- doorState="open"
- print("door opened")
- print(command.cx)
- print(command.cy)
- print(command.cz)
- else
- print("-----------------------")
- redstone.setOutput("top",false)
- redstone.setOutput("front",true)
- sleep(1)
- redstone.setOutput("front",false)
- doorState="close"
- print("door closed")
- print(command.cx)
- print(command.cy)
- print(command.cz)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement