Advertisement
Guest User

chest

a guest
Feb 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.54 KB | None | 0 0
  1. --- TURTLE HOME POSITION
  2. local turtle_home_pos =
  3.     vector.new(0,0,2)
  4.  
  5. --- DIMENSIONS OF ROOM
  6. local num_walls = 7
  7. local wall_depth = 3
  8.  
  9. --- ROOM CORNERS
  10. local corners = {}
  11. local cr_d = 11+(3*(wall_depth-1))
  12. corners[1] = vector.new(0,0,0)
  13. corners[2] = vector.new(0,0,4)
  14. corners[3] = vector.new(6,0,4)
  15. corners[4] = vector.new(6,0,16)
  16. corners[5] = vector.new(cr_d,0,16)
  17. corners[6] = vector.new(cr_d,0,15)
  18. corners[7] = vector.new(6,0,15)
  19. corners[8] = vector.new(6,0,11)
  20. corners[9] = vector.new(cr_d,0,11)
  21. corners[10] = vector.new(cr_d,0,10)
  22. corners[11] = vector.new(6,0,10)
  23. corners[12] = vector.new(6,0,6)
  24. corners[13] = vector.new(cr_d,0,6)
  25. corners[14] = vector.new(cr_d,0,5)
  26. corners[15] = vector.new(6,0,5)
  27. corners[16] = vector.new(6,0,1)
  28. corners[17] = vector.new(cr_d,0,1)
  29. corners[18] = vector.new(cr_d,0,0)
  30.  
  31. --- CHEST POSITIONS
  32. local chests = {}
  33. chests[1] = vector.new(0,0,4) -- DUMP
  34. chests[2] = vector.new(3,0,4) -- SWAP
  35. local cnt = 3 -- new index
  36. local wall = 20 -- start val
  37. local base_depth = 11 -- first depth
  38. for i=1,num_walls do
  39.   if i%2 == 0 then
  40.     wall = wall - 1
  41.   else
  42.     wall = wall - 4
  43.   end
  44.   for j=1,wall_depth do
  45.     chests[cnt] = vector.new(
  46.         wall,0,base_depth+(3*(j-1)))
  47.     cnt = cnt + 1
  48.   end
  49. end
  50.  
  51. function checkFull()
  52.   for i=1,15 do
  53.     select(i)
  54.     if turtle.getItemCount(i) ~= 0 then
  55.       if i==15 then
  56.         return true
  57.       end
  58.     end
  59.   end
  60.   return false
  61. end
  62.  
  63. function fromDump()
  64.   while checkFull() == false do
  65.     while checkFull() == false do
  66.       -- consolidates part stack first
  67.       for i=1,15 do
  68.         turtle.select(i)
  69.         turtle.suck()
  70.       end
  71.     end
  72.     turtle.turnLeft()
  73.     turtle.turnLeft()
  74.     for i=2,15 do
  75.       turtle.select(i)
  76.       if turtle.compareTo(1) == false then
  77.         turtle.drop()
  78.       end
  79.     end
  80.     turtle.turnRight()
  81.     turtle.turnRight()
  82.   end
  83.   turtle.turnLeft()
  84. end
  85.  
  86. function sort()
  87.   turtle.select(16)
  88.   turtle.suck()
  89.   if turtle.compareTo(1) then
  90.     for i=1,16 do
  91.       turtle.select(i)
  92.       turtle.drop()
  93.     end
  94.   end
  95. end
  96.  
  97. -- put the duds back in the dump chest
  98. function replaceDump()
  99.   for i=1,5 do
  100.     for j=1,16 do
  101.       turtle.select(j)
  102.       turtle.suck()
  103.     end
  104.     turtle.turnRight()
  105.     turtle.turnRight()
  106.     for j=1,16 do
  107.       turtle.select(j)
  108.       turtle.drop()
  109.     end
  110.   end
  111. end
  112.  
  113. function home()
  114.  
  115. end
  116.  
  117. function fuel()
  118.  
  119. end
  120.  
  121. function circuit()
  122.  
  123. end
  124.  
  125. fromDump()
  126. turtle.turnLeft()
  127. sort()
  128. turtle.turnRight()
  129. replaceDump()
  130. fromDump()
  131. turtle.turnLeft()
  132. sort()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement