Advertisement
JMANN2400

OceanTempleFiller[NoFuel]

Aug 27th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.44 KB | None | 0 0
  1.  
  2.  
  3.  
  4. x = 0
  5.  
  6. y = 0
  7.  
  8. z = 0
  9.  
  10. slot = 1
  11.  
  12. facing = "north"
  13.  
  14. print("Length = ?")
  15.  
  16. l = tonumber(read())
  17.  
  18. print("Width = ?")
  19.  
  20. w = tonumber(read())
  21.  
  22. function turn(direction)
  23.     if direction == "north" then
  24.         if facing == "west" then
  25.             turtle.turnRight()
  26.         end
  27.         if facing == "south" then
  28.             turtle.turnRight()
  29.             turtle.turnRight()
  30.         end
  31.         if facing == "east" then
  32.             turtle.turnLeft()
  33.         end
  34.         facing = "north"
  35.     end
  36.     if direction == "west" then
  37.         if facing == "south" then
  38.             turtle.turnRight()
  39.         end
  40.         if facing == "east" then
  41.             turtle.turnRight()
  42.             turtle.turnRight()
  43.         end
  44.         if facing == "north" then
  45.             turtle.turnLeft()
  46.         end
  47.         facing = "west"
  48.     end
  49.     if direction == "south" then
  50.         if facing == "east" then
  51.             turtle.turnRight()
  52.         end
  53.         if facing == "north" then
  54.             turtle.turnRight()
  55.             turtle.turnRight()
  56.         end
  57.         if facing == "west" then
  58.             turtle.turnLeft()
  59.         end
  60.         facing = "south"
  61.     end
  62.     if direction == "east" then
  63.         if facing == "north" then
  64.             turtle.turnRight()
  65.         end
  66.         if facing == "west" then
  67.             turtle.turnRight()
  68.             turtle.turnRight()
  69.         end
  70.         if facing == "south" then
  71.             turtle.turnLeft()
  72.         end
  73.         facing = "east"
  74.     end
  75. end
  76.  
  77. function selectSlot()
  78.     if turtle.getItemCount(slot) == 0 and slot < 16 then
  79.         slot = slot + 1
  80.     elseif turtle.getItemCount(slot) == 0 and slot == 16 then
  81.         slot = 1
  82.     end
  83.     turtle.select(slot)
  84. end
  85.  
  86. function pillar()
  87.     repeat
  88.         selectSlot()
  89.         turtle.placeDown()
  90.         sleep(0.1)
  91.         success, data = turtle.inspectDown()
  92.     until data.name == "minecraft:sand"
  93. end
  94.  
  95. function row()
  96.     turn("east")
  97.     while x < w do
  98.         pillar()
  99.         if turtle.forward() then
  100.             x = x + 1
  101.         end
  102.     end
  103.     while x > 0 do
  104.         if turtle.back() then
  105.             x = x - 1
  106.         end
  107.     end
  108. end
  109.  
  110. function digPillar()
  111.     repeat
  112.         turtle.digDown()
  113.         if turtle.down() then
  114.             z = z - 1
  115.         end
  116.         success, data = turtle.inspectDown()
  117.     until data.name ~= "minecraft:sand"
  118.     while z < 0 do
  119.         if turtle.up() then
  120.             z = z + 1
  121.         end
  122.     end
  123. end
  124.  
  125. function digRow()
  126.     turn("east")
  127.     while x < w do
  128.         digPillar()
  129.         if turtle.forward() then
  130.             x = x + 1
  131.         end
  132.     end
  133.     while x > 0 do
  134.         if turtle.back() then
  135.             x = x - 1
  136.         end
  137.     end
  138. end
  139.  
  140. function fullDig()
  141.     row()
  142.     turn("north")
  143.     while y < l do
  144.         if turtle.forward() then
  145.             y = y + 1
  146.         end
  147.         row()
  148.         turn("south")
  149.         if turtle.forward() then
  150.             y = y - 1
  151.         end
  152.         digRow()
  153.         turn("north")
  154.         if turtle.forward() then
  155.             y = y + 1
  156.         end
  157.     end
  158. end
  159.  
  160. fullDig()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement