Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem = peripheral.wrap("right")
- modem.open(365)
- os.loadAPI("open")
- os.loadAPI("close")
- while true do
- -- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- local message = "open"
- checkBarricade()
- end
- function checkBarricade()
- turtle.dig()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- if message == "open" then
- if turtle.detect() then
- open.openDoor()
- elseif not turtle.detect() then
- goHome()
- end
- elseif message == "close" then
- if turtle.detect() then
- goHome()
- elseif not turtle.detect() then
- close.closeDoor()
- end
- end
- end
- function goHome()
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- end
- while true do
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement