Advertisement
Guest User

InfiniRom

a guest
Dec 8th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1. -- InfiniRom 1.0 by AwesomeBananas
  2.  
  3. slotCounter = 4
  4.  
  5. function StructureBuildSequence(buildingDirection, seqBuildWidth, seqBuildHeight)
  6.   function StorageDrop()
  7.     turtle.select(slotCounter)
  8.     if not turtle.drop() then
  9.       if turtle.getSelectedSlot == 16 then
  10.         turtle.select(3)
  11.         turtle.turnRight()
  12.         turtle.dig()
  13.         turtle.place()
  14.         repeat
  15.           turtle.suck()
  16.         until turtle.getItemCount(16) > 0
  17.         turtle.dig()
  18.         turtle.turnLeft()
  19.         turtle.select(4)
  20.         slotCounter = 4
  21.         turtle.drop()
  22.       else
  23.         error("BUG IN CODE")
  24.       end
  25.     else
  26.       slotCounter = slotCounter + 1
  27.   end
  28.  
  29.   function DriveWallBuildSequence(prevUpDownLatch, buildingDirection, seqBuildWidth, seqBuildHeight)
  30.     turtle.select(1) -- Turtle select 198
  31.     if prevUpDownLatch == 'down' then
  32.       oddDirection = 'up'
  33.       evenDirection = 'down'
  34.     elseif prevUpDownLatch == 'up' then
  35.       oddDirection = 'down'
  36.       evenDirection = 'up'
  37.     end
  38.     for i = 1, seqBuildWidth do
  39.       if buildingDirection == 'left' then
  40.         turtle.turnLeft)
  41.       elseif buildingDirection == 'right' then
  42.         turtle.turnRight()
  43.       end
  44.       for i2 = 1, seqBuildHeight do
  45.         turtle.dig()
  46.         turtle.place()
  47.         --PLACEMENT DROP
  48.         StorageDrop()
  49.         if i2 ~= seqBuildHeight then
  50.           if i2 % 2 ~= 0 then
  51.             if oddDirection == 'down' then
  52.               turtle.digDown()
  53.               turtle.down()
  54.             elseif oddDirection == 'up' then
  55.               turtle.digUp()
  56.               turtle.up()
  57.             end
  58.           elseif i2 % 2 == 0 then
  59.             if evenDirection == 'down' then
  60.               turtle.digDown()
  61.               turtle.down()
  62.             elseif evenDirection == 'up' then
  63.               turtle.digUp()
  64.               turtle.up()
  65.             end
  66.           end
  67.         end
  68.       end
  69.       if buildingDirection == 'left' then
  70.         turtle.turnRight()
  71.       elseif buildingDirection == 'right' then
  72.         turtle.turnLeft()
  73.       end
  74.       turtle.dig()
  75.       turtle.forward()
  76.     end
  77.     if seqBuildWidth % 2 == 0 then
  78.       prevUpDownLatch = 'down'
  79.     elseif seqBuildWith % 2 ~= 0 then
  80.       prevUpDownLatch = 'up'
  81.     end  
  82.   end
  83.   DriveWallBuildSequence(
  84. end
  85.  
  86. StructureBuildSequence('down', 'left', 3, 3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement