Advertisement
ThatBlueMoon

Baumfarm

Jul 4th, 2022 (edited)
953
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 KB | None | 0 0
  1. -- programm for cowspwanwer kühe runter schlagen bewegt ini nem 7x7 ring
  2.  
  3. local heading
  4. local x, y, z = 0, 0, 0
  5.  
  6. --die Richtung in die er jetzt gerade guckt
  7. local direction = 1
  8. local blcokkdata
  9.  
  10.  
  11. function turnleft()
  12.     turtle.turnLeft()
  13.     if(direction == 1)
  14.     then
  15.         direction = 4
  16.     else
  17.         direction = direction - 1
  18.     end
  19. end
  20.  
  21. function turnright()
  22.     turtle.turnRight()
  23.     if(direction == 4)
  24.     then
  25.         direction = 1
  26.     else
  27.         direction = direction + 1
  28.     end
  29. end
  30.  
  31. function digmove(schritte)
  32.     for i = 1, schritte do
  33.         if(direction == 1)
  34.         then
  35.             x = x + 1
  36.         elseif(direction == 2)
  37.         then
  38.             z = z + 1
  39.         elseif(direction == 3)
  40.         then
  41.             x = x - 1
  42.         elseif(direction == 4)
  43.         then
  44.             z = z - 1
  45.         end
  46.    
  47.         for i = 1, schritte, 1 do
  48.         while(turtle.detect()) do
  49.             turtle.dig()
  50.         end
  51.         turtle.forward()
  52.         end
  53.     end
  54. end
  55.  
  56.  
  57.  -- ändern wenn ich cooleres fuel habe
  58.  
  59. function refuel()
  60.     turtle.drop(turtle.getItemCount())
  61.     turtle.suckDown(1)
  62.     turtle.refuel()
  63.     turtle.dropDown(1)
  64. end
  65.  
  66.  
  67. --programm start
  68.  
  69. while(true) do
  70.     if(turtle.detectDown() and turtle.getFuelLevel() < 100)
  71.     then
  72.         refuel()
  73.     end
  74.  
  75.  
  76.     --- nächsten 5
  77.     for i = 1, 5 do
  78.         digmove(1)
  79.         turnleft()
  80.         turtle.attack()
  81.         turnright()
  82.         turnright()
  83.         turtle.attack()
  84.         turnleft()
  85.     end
  86.     --letzter block
  87.     digmove(1)
  88.     turnleft()
  89.     turtle.attack()
  90.     turnright()
  91.     turtle.attack()
  92.     turnright()
  93.  
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement