Ferruccioboss

Minecraft>BaseGateTurtle

May 31st, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.88 KB | None | 0 0
  1. rednet.open("right")
  2. local status = "close-gate"
  3.  
  4. function moveForward()
  5.     while not turtle.forward() do
  6.     end
  7. end
  8.  
  9. function moveBack()
  10.     while not turtle.back() do
  11.     end
  12. end
  13.  
  14. function moveUp()
  15.     while not turtle.up() do
  16.     end
  17. end
  18.  
  19. function moveDown()
  20.     while not turtle.down() do
  21.     end
  22. end
  23.  
  24. function openGate()
  25.     turtle.dig()
  26.     for c=0, 2, 1 do
  27.         moveForward()
  28.     end
  29.     for c=0, 1, 1 do
  30.         moveUp()
  31.     end
  32.     turtle.digUp()
  33.     moveUp()
  34.     turtle.dig()
  35.     moveForward()
  36.     turtle.turnRight()
  37.     turtle.dig()
  38.     moveForward()
  39.     turtle.turnRight()
  40.     turtle.dig()
  41.     moveForward()
  42.     turtle.dig()
  43.     moveForward()
  44.     turtle.turnRight()
  45.     turtle.dig()
  46.     moveForward()
  47.     turtle.dig()
  48.     moveForward()
  49.     turtle.turnRight()
  50.     turtle.dig()
  51.     moveForward()
  52.     turtle.dig()
  53.     turtle.digUp()
  54.     moveUp()
  55.     turtle.dig()
  56.     moveForward()
  57.     turtle.turnRight()
  58.     turtle.dig()
  59.     moveForward()
  60.     turtle.turnRight()
  61.     turtle.dig()
  62.     turtle.turnLeft()
  63.     turtle.dig()
  64.     moveForward()
  65.     turtle.turnRight()
  66.     turtle.dig()
  67.     moveForward()
  68.     turtle.dig()
  69.     moveForward()
  70.     turtle.turnRight()
  71.     turtle.dig()
  72.     moveForward()
  73.     turtle.dig()
  74.     turtle.turnLeft()
  75.     for c=0, 3, 1 do
  76.         moveDown()
  77.     end
  78.     for c=0, 1, 1 do
  79.         moveForward()
  80.     end
  81.     turtle.turnRight()
  82.     turtle.turnRight()
  83.     turtle.select(1)
  84.     turtle.place()
  85. end
  86.  
  87. function closeGate()
  88.     turtle.dig()
  89.     turtle.dig()
  90.     for c=0, 2, 1 do
  91.         moveForward()
  92.     end
  93.     for c=0, 3, 1 do
  94.         moveUp()
  95.     end
  96.     turtle.select(2)
  97.     turtle.place()
  98.     turtle.turnRight()
  99.     moveForward()
  100.     turtle.turnLeft()
  101.     turtle.place()
  102.     turtle.turnRight()
  103.     turtle.turnRight()
  104.     turtle.place()
  105.     turtle.turnLeft()
  106.     moveBack()
  107.     turtle.place()
  108.     turtle.turnRight()
  109.     turtle.place()
  110.     turtle.turnRight()
  111.     moveForward()
  112.     turtle.turnLeft()
  113.     turtle.place()
  114.     turtle.turnRight()
  115.     turtle.turnRight()
  116.     turtle.place()
  117.     turtle.turnLeft()
  118.     moveBack()
  119.     turtle.place()
  120.     moveDown()
  121.     turtle.placeUp()
  122.     turtle.select(1)
  123.     moveForward()
  124.     turtle.turnLeft()
  125.     turtle.place()
  126.     turtle.turnRight()
  127.     turtle.turnRight()
  128.     turtle.place()
  129.     turtle.turnLeft()
  130.     moveBack()
  131.     turtle.place()
  132.     turtle.turnRight()
  133.     turtle.place()
  134.     turtle.turnRight()
  135.     moveForward()
  136.     turtle.turnLeft()
  137.     turtle.place()
  138.     turtle.turnRight()
  139.     turtle.turnRight()
  140.     turtle.place()
  141.     turtle.turnLeft()
  142.     moveBack()
  143.     turtle.place()
  144.     turtle.turnRight()
  145.     turtle.place()
  146.     moveDown()
  147.     turtle.placeUp()
  148.     moveDown()
  149.     moveDown()
  150.     for c=0, 2, 1 do
  151.         moveForward()
  152.     end
  153.     turtle.turnRight()
  154.     turtle.turnRight()
  155.     turtle.place()
  156. end
  157.  
  158. while true do
  159.         event, id, text = os.pullEvent()
  160.     if event == "rednet_message" then
  161.         if id == 23 then
  162.                 if text == "open-gate" and status == "close-gate" then
  163.                         status = text
  164.                 openGate()
  165.                 rednet.send(23,"open-done")
  166.             elseif text == "close-gate" and status == "open-gate" then
  167.                 status = text
  168.                 closeGate()
  169.                 rednet.send(23,"close-done")
  170.                     end
  171.         end
  172.     end
  173. end
Advertisement
Add Comment
Please, Sign In to add comment