Keledan

muratore

Mar 24th, 2015
622
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.29 KB | None | 0 0
  1. -- costruisce un edificio di x per y con altezza z con tetto piatto
  2. -- il primo piano è il pavimento.
  3. -- Slot 1 carburante Slot 2 pavimento slot 3 pareti slot 4 tetto
  4. x = 5
  5. y = 4
  6. z = 4
  7.  
  8. local function mura ()
  9.     turtle.select(3)
  10.         turtle.turnLeft()
  11.         turtle.turnLeft()
  12.         turtle.forward()   
  13.         turtle.up()
  14.     for altezza = 1, z do
  15.         for n = 1, x do
  16.             turtle.forward()
  17.             turtle.placeDown()
  18.         end
  19.             turtle.turnRight()
  20.         for n = 1, (y-1) do
  21.             turtle.forward()
  22.             turtle.placeDown()
  23.         end
  24.             turtle.turnRight()
  25.         for n = 1, (x-1) do
  26.             turtle.forward()
  27.             turtle.placeDown()
  28.         end
  29.             turtle.turnRight()
  30.         for n = 1, (y-2) do
  31.             turtle.forward()
  32.             turtle.placeDown()
  33.             turtle.forward()
  34.         end
  35.         turtle.up()
  36.         turtle.turnRight()
  37.         turtle.back()
  38.     end
  39. end
  40.  
  41. local function pavimento()
  42.     print ("poso il pavimento...")
  43.     turtle.select (2)
  44.     for n = 1, x do
  45.         for n = 1, y do
  46.         turtle.digDown()
  47.         turtle.dig()
  48.         turtle.placeDown()
  49.         turtle.forward()
  50.         end
  51.         if n < x then prossima_fila (n ) end
  52.     end
  53. end
  54.  
  55. function prossima_fila(n)
  56.     if (n % 2 == 0) then
  57.         turtle.turnRight()
  58.         turtle.forward()
  59.         turtle.turnRight()
  60.         turtle.forward()  
  61.     else
  62.         turtle.turnLeft()
  63.         turtle.forward()
  64.         turtle.turnLeft()
  65.         turtle.forward()  
  66.     end
  67.  
  68. end
  69.  
  70. --pavimento()
  71.  
  72. mura ()
Advertisement
Add Comment
Please, Sign In to add comment