Advertisement
turtlekek

Quader

Dec 16th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.05 KB | None | 0 0
  1. print("Breite: ")
  2. breite = tonumber(read())
  3. print("Hoehe: ")
  4. hoehe = tonumber(read())
  5. print("Weite: ")
  6. weite = tonumber(read())
  7.  
  8. function test(lel, lol)
  9.     print(lel)
  10.     print(lol)
  11. end --test()
  12.  
  13. test("lel", "lol")
  14.  
  15. function digLine(blocks)
  16.     print("digLine" .. tostring(blocks))
  17.     for i = 1, blocks do
  18.         turtle.dig()
  19.         turtle.forward()
  20.     end --for
  21. end --digLine()
  22.  
  23. function digLayer(height, width)
  24.     print("digLayer"  .. tostring(height)  .. tostring(width))
  25.     if height % 2 == 0 then
  26.         digLayerEven(height, width)
  27.     else
  28.         digLayerOdd(height, width)
  29.     end
  30. end --digLayer()
  31.  
  32. function digLayerOdd(height, width)
  33.     print("digLayerOdd" .. tostring(height) .. tostring(width))
  34.     digLayerEven(height - 1, width)
  35.     turtle.digUp()
  36.     turtle.up()
  37.     turtle.turnRight()
  38.     digLine(width - 1)
  39.     turnAround()
  40.     digLine(width - 1)
  41.     turtle.turnRight()
  42. end --digLayerOdd()
  43.  
  44. function digLayerEven(height, width)
  45.     print("digLayerEven" .. tostring(height) .. tostring(width))
  46.     turtle.dig()
  47.     turtle.forward()
  48.     for i = 1, height / 2 do
  49.         turtle.turnRight()
  50.         digLine(width -1)
  51.         turtle.digUp()
  52.         turtle.up()
  53.         turnAround()
  54.         digLine(width -1)
  55.         turtle.turnRight()
  56.         if i == height/2 then
  57.             goBackDown(height -1)
  58.         else
  59.             turtle.digUp()
  60.             turtle.up()
  61.         end --if
  62.     end --for
  63.     goBackDown(height-1)
  64. end --digLayerEven()
  65.  
  66. function digTunnelEven(height, width, depth)
  67.     print("digTunnelEven" .. tostring(height) .. tostring(width) .. tostring(depth))
  68.     for i = 1, depth do
  69.         digLayerEven(height, width)
  70.     end --for
  71. end --digTunnel()
  72.  
  73. function turnAround()
  74.     print("turnAround")
  75.     turtle.turnLeft()
  76.     turtle.turnLeft()
  77. end --turnAround()
  78.  
  79. function goBackDown(blocks)
  80.     print("goBackDown" .. tostring(blocks))
  81.     for i = 1, blocks do
  82.         turtle.down()
  83.     end --for
  84. end --goBackDown()
  85.  
  86. print("starting")
  87. digTunnelEven(hoehe, breite, weite)
  88. print("done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement