Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- local status = "close-gate"
- function moveForward()
- while not turtle.forward() do
- end
- end
- function moveBack()
- while not turtle.back() do
- end
- end
- function moveUp()
- while not turtle.up() do
- end
- end
- function moveDown()
- while not turtle.down() do
- end
- end
- function openGate()
- turtle.dig()
- for c=0, 2, 1 do
- moveForward()
- end
- for c=0, 1, 1 do
- moveUp()
- end
- turtle.digUp()
- moveUp()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.dig()
- turtle.digUp()
- moveUp()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- turtle.turnLeft()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.dig()
- moveForward()
- turtle.turnRight()
- turtle.dig()
- moveForward()
- turtle.dig()
- turtle.turnLeft()
- for c=0, 3, 1 do
- moveDown()
- end
- for c=0, 1, 1 do
- moveForward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.select(1)
- turtle.place()
- end
- function closeGate()
- turtle.dig()
- turtle.dig()
- for c=0, 2, 1 do
- moveForward()
- end
- for c=0, 3, 1 do
- moveUp()
- end
- turtle.select(2)
- turtle.place()
- turtle.turnRight()
- moveForward()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- moveBack()
- turtle.place()
- turtle.turnRight()
- turtle.place()
- turtle.turnRight()
- moveForward()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- moveBack()
- turtle.place()
- moveDown()
- turtle.placeUp()
- turtle.select(1)
- moveForward()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- moveBack()
- turtle.place()
- turtle.turnRight()
- turtle.place()
- turtle.turnRight()
- moveForward()
- turtle.turnLeft()
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- moveBack()
- turtle.place()
- turtle.turnRight()
- turtle.place()
- moveDown()
- turtle.placeUp()
- moveDown()
- moveDown()
- for c=0, 2, 1 do
- moveForward()
- end
- turtle.turnRight()
- turtle.turnRight()
- turtle.place()
- end
- while true do
- event, id, text = os.pullEvent()
- if event == "rednet_message" then
- if id == 23 then
- if text == "open-gate" and status == "close-gate" then
- status = text
- openGate()
- rednet.send(23,"open-done")
- elseif text == "close-gate" and status == "open-gate" then
- status = text
- closeGate()
- rednet.send(23,"close-done")
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment