Bendix

Raum

Aug 24th, 2020 (edited)
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | None | 0 0
  1. --45 weit 45 breit
  2. --1 Gravel
  3. --2 Erde
  4. --3 Stein
  5. --14 Fackel
  6. --15 Kohle
  7. --16 Kiste
  8.  
  9. print("wie weit?")
  10. weit = io.read()
  11. print("wieviel zusaetzlich nach oben?")
  12. print("3+")
  13. hoch=0+ io.read()
  14. print("wie breit?")
  15. breit= io.read()
  16.  
  17.  
  18. function full()
  19.   if turtle.getItemCount(1) > 50 then turtle.select(1) turtle.drop(49) end
  20.   if turtle.getItemCount(2) > 50 then turtle.select(2) turtle.drop(49) end
  21.   if turtle.getItemCount(3) > 50 then turtle.select(3) turtle.drop(49) end  
  22. end
  23. function fuel()
  24.   while turtle.getFuelLevel() < 500 do
  25.     turtle.select(15)
  26.     turtle.refuel(1)
  27.   end
  28. end
  29. function forward()
  30.   while turtle.forward() == false do
  31.     turtle.dig()
  32.     turtle.attack()
  33.   end
  34. end
  35. function dig()
  36. fuel()
  37.   while turtle.detect() == true do
  38.     turtle.dig()
  39.     full()
  40.     turtle.attack()
  41.     sleep(0.5)
  42.   end
  43. end
  44. function digUp()
  45.   while turtle.detectUp() == true do
  46.     full()
  47.     turtle.digUp()
  48.     sleep(0.5)
  49.   end
  50. end
  51. function digDown()
  52.   full()
  53.   turtle.select(14)
  54.   if turtle.compareDown(14) == false then
  55.     turtle.digDown()
  56.   end
  57. end
  58. function unload()
  59. for x=4,13 do
  60.   turtle.select(x)
  61.   turtle.dropDown()
  62. end
  63. turtle.select(14)
  64. end
  65. for y=1,breit do
  66.   for x=1,weit do
  67.     digUp()
  68.     turtle.select(16)
  69.     if turtle.compareDown(16) == true then
  70.     unload()
  71.     turtle.select(15)
  72.     else  
  73.       digDown()
  74.     end
  75.     dig()
  76.     forward()
  77.   end
  78.   digDown()
  79. x=0
  80. while x < hoch do
  81.   digUp()
  82.   turtle.up()
  83.   x=x+1
  84. end
  85.   turtle.turnLeft()
  86.   turtle.turnLeft()
  87.   for x=1,weit do
  88.     dig()
  89.     digUp()
  90.     digDown()
  91.     forward()
  92.   end
  93.   digUp()
  94.   x=0
  95.   while x < hoch do
  96.   turtle.down()
  97.   x=x+1
  98. end
  99.   turtle.turnRight()
  100.   for z=1,y-1 do
  101.     turtle.back()
  102.   end
  103.   unload()
  104.   for z=1,y-1 do
  105.     dig()
  106.     forward()
  107.   end
  108.   forward()
  109.   turtle.turnRight()
  110. end
  111. turtle.turnLeft()    
  112. for x=1,breit do
  113. turtle.back()
  114. end
  115. turtle.turnRight()
  116.  
Add Comment
Please, Sign In to add comment