Advertisement
pson

Plattform

May 6th, 2016
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.93 KB | None | 0 0
  1. function placeDown(b, e)
  2.    for i=b,e do
  3.       if turtle.getItemCount(i) then
  4.      turtle.select(i)
  5.      turtle.placeDown()
  6.      sleep(0.2)
  7.       end
  8.    end
  9.    turtle.select(9)
  10. end
  11.  
  12. function placeForward()
  13.    for i=b,e do
  14.       if turtle.getItemCount(i) then
  15.      turtle.select(i)
  16.      turtle.place()
  17.      sleep(0.2)
  18.       end
  19.    end
  20.    turtle.select(9)
  21. end
  22.  
  23. function row(n, b, e)
  24.    local i = 1
  25.    while turtle.getFuelLevel() < 100 do
  26.       turtle.select(16)
  27.       turtle.refuel(1)
  28.    end
  29.    while i < n do
  30.       placeDown(b, e)
  31.       turtle.forward()
  32.       sleep(0.2)
  33.       i = i+1
  34.    end
  35.    placeDown(b, e)
  36. end
  37.  
  38. function platform(l, w, b, e)
  39.    local odd = 1
  40.    local i, j
  41.  
  42.    for i=1,w do
  43.       row(l, b, e)
  44.       if odd == 1 then
  45.      turtle.turnRight()
  46.      turtle.forward()
  47.      sleep(0.2)
  48.      turtle.turnRight()
  49.       else
  50.      turtle.turnLeft()
  51.      turtle.forward()
  52.      sleep(0.2)
  53.      turtle.turnLeft()
  54.       end
  55.       odd = 1 - odd
  56.    end
  57.    if odd == 1 then
  58.       turtle.turnLeft()
  59.       for i=1,w do
  60.      turtle.forward()
  61.      sleep(0.2)
  62.       end
  63.       turtle.turnRight()
  64.    else
  65.       turtle.turnRight()
  66.       for i=1,w do
  67.      turtle.forward()
  68.      sleep(0.2)
  69.       end
  70.       turtle.turnRight()
  71.       for i=1,l-1 do
  72.      turtle.back()
  73.      sleep(0.2)
  74.       end
  75.    end
  76. end
  77.  
  78. function cellar(n)
  79.    for i=1,8 do
  80.       if turtle.detectDown() then
  81.      turtle.digDown()
  82.      sleep(0.2)
  83.       end
  84.       turtle.down()
  85.       sleep(0.2)
  86.    end
  87.    platform(n, n, 5, 8)
  88.    turtle.up()
  89.    platform(n, n, 1, 4)
  90.    turtle.forward()
  91.    turtle.turnLeft()
  92.    turtle.turnLeft()
  93.    sleep(0.3)
  94.    for i=1,7 do
  95.       placeForward(5, 8)
  96.       if turtle.detectUp() then
  97.      turtle.digUp()
  98.      sleep(0.2)
  99.       end
  100.       turtle.up()
  101.       sleep(0.2)
  102.    end
  103. end
  104.  
  105. function floor(n)
  106.    turtle.forward()
  107.    sleep(0.2)
  108.    turtle.down()
  109.    sleep(0.2)
  110.    platform(n, n, 5, 8)
  111.    turtle.up()
  112.    sleep(0.2)
  113.    platform(n, n, 1, 4)
  114. end
  115.  
  116. floor(7)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement