PaleoCrafter

Untitled

Jan 19th, 2021 (edited)
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SAFE_SLOTS = 1
  2. LAST_FILLER_SLOT = 8
  3. SLOT_COUNT = 16
  4.  
  5. function selectFiller()
  6.   for slot = SAFE_SLOTS + 1, SLOT_COUNT do
  7.     turtle.select(slot)
  8.     if turtle.compareTo(2) and turtle.getItemCount() > 1 then
  9.       return
  10.     end
  11.   end
  12. end
  13.  
  14. function placeFiller(direction)
  15.   if direction == nil then
  16.     direction = ''
  17.   end
  18.  
  19.   while turtle['detect' .. direction]() do
  20.     turtle['dig' .. direction]()
  21.   end
  22.   selectFiller()
  23.   turtle['place' .. direction]()
  24. end
  25.  
  26. function clear(direction)
  27.   if direction == nil then
  28.     direction = ''
  29.   end
  30.  
  31.   while turtle['detect' .. direction]() do
  32.     selectFiller()
  33.     turtle['place' .. direction]()
  34.     turtle['dig' .. direction]()
  35.   end
  36. end
  37.  
  38. function move(direction)
  39.   clear(direction)
  40.  
  41.   if direction == nil or direction == '' then
  42.     turtle.forward()
  43.   elseif direction == 'Up' then
  44.     turtle.up()
  45.   else
  46.     turtle.down()
  47.   end
  48. end
  49.  
  50. function dropNonFuel()
  51.   for slot = LAST_FILLER_SLOT + 1, SLOT_COUNT do
  52.     turtle.select(slot)
  53.     if not turtle.refuel() then
  54.       turtle.drop()
  55.     end
  56.   end
  57. end
  58.  
  59. function buildLayer(width, height)
  60.   direction = 'Right'
  61.   for x = 1, width do
  62.     for y = 1, height - 1 do
  63.       clear('Down')
  64.       move()
  65.     end
  66.     clear('Down')
  67.     turtle['turn' .. direction]()
  68.     move()
  69.     turtle['turn' .. direction]()
  70.     if direction == 'Right' then
  71.       direction = 'Left'
  72.     else
  73.       direction = 'Right'
  74.     end
  75.   end
  76.  
  77.   if direction == 'Left' then
  78.     turtle.turnRight()
  79.     move()
  80.     turtle.turnLeft()
  81.   else
  82.     turtle.turnLeft()
  83.     move()
  84.     turtle.turnRight()
  85.   end
  86.  
  87.   move('Down')
  88.  
  89.   dropNonFuel()
  90. end
  91.  
  92. turtle.turnLeft()
  93. turtle.forward()
  94. turtle.forward()
  95. turtle.turnLeft()
  96. turtle.forward()
  97. turtle.forward()
  98. turtle.turnLeft()
  99. turtle.turnLeft()
  100.  
  101. for i = 1,45 do
  102.   buildLayer(5, 5)
  103. end
Add Comment
Please, Sign In to add comment