Advertisement
lhenders

PathBuilder

Apr 19th, 2016
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.51 KB | None | 0 0
  1. -- **** READ ME ****
  2. -- Version 1.01
  3. -- **** Purpose ****
  4. -- Designed for path building in
  5. -- FTB Infinity Evolved Skyblock
  6. -- to connect the "Islands" using a turtle
  7. -- example: 2000 blocks apart with VOID below.
  8. --
  9. -- **** Actions ****
  10. -- The turtle will continue straight forward,
  11. -- building the path as long as it has enough
  12. -- resources in it to do another set of 4 rows.
  13. -- 20 cobble in a stack, at least 1 torch and
  14. -- at least enough fuel to move 20 spaces.
  15. --
  16. -- **** Layout ****
  17. -- C = Cobblestone (or any place-able block)
  18. -- T = Torch (Note only placed every 4 rows)
  19. -- S = Starting Location
  20. --  Side View           Top View
  21. --   T                  TCCCC
  22. --   C   C               S
  23. --    CCC
  24. --
  25. -- **** Known bugs/inefficiencies ****
  26. -- 1) Cobble usage needs a tweak, it leaves small
  27. --    stacks in the slots if they are less than 20.
  28. -- 2) Fuel consumption/usage needs a small tweak,
  29. --    currently it consumes the whole stack in slot
  30. --    1, instead of just enough to do a cycle
  31. --
  32. -- **** SETUP ****
  33. -- Place turtle where you want the left walk way to be.
  34. --
  35. -- Add resources:
  36. -- slot 1 reserved for fuel.
  37. -- slot 2-15 reserved for cobblestone
  38. -- slot 16 reserved for torches
  39. --
  40. -- **** END README ****
  41.  
  42. currentSlot = 2
  43. rowCount = 1
  44. run=1
  45.  
  46. function refuel()
  47.   print("Current Fuel Level: " .. turtle.getFuelLevel())
  48.   if turtle.getFuelLevel() < 20 then
  49.     turtle.select(1)
  50.     if turtle.getItemCount(1) < 20 then
  51.       print("Need Fuel! Place fuel in slot 1, 10 minimum")
  52.       run=0
  53.     else
  54.      turtle.refuel(turtle.getItemCount(1))
  55.      print("Refueled, new level" .. turtle.getFuelLevel())
  56.     end
  57.   end
  58. end
  59.  
  60. function cobbleSupplies()
  61.   if turtle.getItemCount(currentSlot)>=20 then
  62.     print("Current Cobblestone Level: " .. turtle.getItemCount(currentSlot))
  63.   else
  64.     for i = 2, 15  do
  65.       currentSlot = i
  66.       if turtle.getItemCount(i)>=20 then
  67.        turtle.select(currentSlot)
  68.        print("New Cobblestone Level: " .. turtle.getItemCount(currentSlot))
  69.        return 0
  70.       end
  71.     end
  72.   end
  73.   if (currentSlot == 15 or turtle.getItemCount(currentSlot) <20) then
  74.     print("Need Cobblestone in slot 2 through 15, add at least 10 a slot!")
  75.        currentSlot = 2
  76.        run=0
  77.   end
  78. end
  79.  
  80. function torches()
  81.   print("Current Torch Level: " .. turtle.getItemCount(16))
  82.   if turtle.getItemCount(16) < 1 then
  83.      print("Need to add at least 1 torch, to slot 16!")
  84.      run=0
  85.   end
  86. end
  87. function gridSupplies()
  88.   refuel()
  89.   cobbleSupplies()
  90.   torches()
  91. end
  92.  
  93. function placeGrid()
  94.   gridSupplies()
  95.   if run == 0 then return 0 end
  96.   turtle.select(currentSlot)
  97.  
  98.   turtle.forward()
  99.   turtle.placeDown() -- Left path block - row 1
  100.   turtle.turnLeft() -- Pointing Left
  101.   turtle.place() -- Left Guide 1
  102.   turtle.turnRight()  -- turn around
  103.   turtle.turnRight()
  104.   turtle.forward()  -- move one to the right
  105.   turtle.placeDown() -- Left path block - row 1
  106.   turtle.forward()  -- move one to the right
  107.   turtle.placeDown() -- center path block - row 1
  108.   turtle.place() -- right Guide 1
  109.   turtle.turnLeft()
  110.  
  111.   turtle.forward()
  112.   turtle.placeDown() -- Left path block - row 2
  113.   turtle.turnRight()
  114.   turtle.place() -- Right Guide 2
  115.   turtle.turnLeft()  -- turn around
  116.   turtle.turnLeft()
  117.   turtle.forward()  -- move one to the right
  118.   turtle.placeDown() -- Left path block - row 2
  119.   turtle.forward()  -- move one to the right
  120.   turtle.placeDown() -- center path block - row 2
  121.   turtle.place() -- Left Guide 2
  122.   turtle.turnRight()
  123.  
  124. turtle.forward()
  125.   turtle.placeDown() -- Left path block - row 3
  126.   turtle.turnLeft() -- Pointing Left
  127.   turtle.place() -- Left Guide 3
  128.   turtle.turnRight()  -- turn around
  129.   turtle.turnRight()
  130.   turtle.forward()  -- move one to the right
  131.   turtle.placeDown() -- Left path block - row 3
  132.   turtle.forward()  -- move one to the right
  133.   turtle.placeDown() -- center path block - row 3
  134.   turtle.place() -- right Guide 3
  135.   turtle.turnLeft()
  136.  
  137.   turtle.forward()
  138.   turtle.placeDown() -- Left path block - row 4
  139.   turtle.turnRight()
  140.   turtle.place() -- Right Guide 4
  141.   turtle.turnLeft()  -- turn around
  142.   turtle.turnLeft()
  143.   turtle.forward()  -- move one to the right
  144.   turtle.placeDown() -- Left path block - row 4
  145.   turtle.forward()  -- move one to the right
  146.   turtle.placeDown() -- center path block - row 4
  147.   turtle.place() -- Left Guide 4
  148.  
  149.   -- place a torch
  150.   turtle.select(16)
  151.   turtle.up()
  152.   turtle.place()
  153.   turtle.down()
  154.   turtle.select(currentSlot)
  155.   turtle.turnRight()
  156. end
  157.  
  158. while run == 1 do
  159.   placeGrid()
  160. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement