SHOW:
|
|
- or go back to the newest paste.
| 1 | local tArgs = { ... }
| |
| 2 | - | if #tArgs ~= 2 then |
| 2 | + | if #tArgs ~= 1 then |
| 3 | - | print( "Usage: bridge <length> <direction of landmark (L, R, B)>" ) |
| 3 | + | print( "Usage: quarry size <length>" ) |
| 4 | print( "Place blocks in slots 1 - 14, place landmarks in 16" ) | |
| 5 | return | |
| 6 | end | |
| 7 | ||
| 8 | -- Set length with user input | |
| 9 | local length = tonumber( tArgs[1] ) | |
| 10 | - | print( "Bridge length must be positive" ) |
| 10 | + | |
| 11 | print( "Side length must be positive" ) | |
| 12 | return | |
| 13 | end | |
| 14 | - | -- Check that there are <length> |
| 14 | + | local curSlot = 1 |
| 15 | - | -- blocks provided in slot 9 |
| 15 | + | |
| 16 | - | --local numblocks = turtle.getItemCount(9) |
| 16 | + | if not (turtle.detectDown()) then |
| 17 | - | --if numblocks < length then |
| 17 | + | while turtle.getItemCount(curSlot) == 0 and curSlot < 16 do |
| 18 | - | -- print("Please place at least "..length.." building blocks in slot 9")
|
| 18 | + | curSlot = curSlot + 1 |
| 19 | - | -- return |
| 19 | + | end |
| 20 | - | --end |
| 20 | + | turtle.select(curSlot) |
| 21 | turtle.placeDown() | |
| 22 | - | -- Place a block underneath |
| 22 | + | |
| 23 | - | -- the turtle to build bridge |
| 23 | + | |
| 24 | ||
| 25 | - | if not (turtle.detectDown()) then |
| 25 | + | |
| 26 | - | turtle.select(9) |
| 26 | + | function placelmf() |
| 27 | - | turtle.placeDown() |
| 27 | + | if not (turtle.detect()) then |
| 28 | putblockdown() | |
| 29 | turtle.back() | |
| 30 | turtle.select(16) | |
| 31 | turtle.place() | |
| 32 | - | function placelm() |
| 32 | + | |
| 33 | - | if tArgs[2] == "R" then |
| 33 | + | |
| 34 | - | if not (turtle.detect()) then |
| 34 | + | |
| 35 | - | turtle.turnRight() |
| 35 | + | -- Place Landmark left and right |
| 36 | - | turtle.forward() |
| 36 | + | function placelmb() |
| 37 | - | turtle.select(9) |
| 37 | + | if not (turtle.detect()) then |
| 38 | - | turtle.placeDown() |
| 38 | + | turtle.turnRight() |
| 39 | - | turtle.back() |
| 39 | + | turtle.forward() |
| 40 | - | turtle.select(10) |
| 40 | + | putblockdown() |
| 41 | - | turtle.place() |
| 41 | + | turtle.back() |
| 42 | - | turtle.turnLeft() |
| 42 | + | turtle.select(16) |
| 43 | - | end |
| 43 | + | turtle.place() |
| 44 | turtle.turnLeft() | |
| 45 | - | if tArgs[2] == "L" then |
| 45 | + | turtle.turnLeft() |
| 46 | - | if not (turtle.detect()) then |
| 46 | + | turtle.forward() |
| 47 | - | turtle.turnLeft() |
| 47 | + | putblockdown() |
| 48 | - | turtle.forward() |
| 48 | + | turtle.back() |
| 49 | - | turtle.select(9) |
| 49 | + | turtle.select(16) |
| 50 | - | turtle.placeDown() |
| 50 | + | turtle.place() |
| 51 | - | turtle.back() |
| 51 | + | turtle.turnRight() |
| 52 | - | turtle.select(10) |
| 52 | + | |
| 53 | - | turtle.place() |
| 53 | + | |
| 54 | - | turtle.turnRight() |
| 54 | + | |
| 55 | - | end |
| 55 | + | |
| 56 | x = length | |
| 57 | - | if tArgs[2] == "B" then |
| 57 | + | |
| 58 | - | if not (turtle.detect()) then |
| 58 | + | |
| 59 | - | turtle.turnRight() |
| 59 | + | |
| 60 | - | turtle.forward() |
| 60 | + | |
| 61 | - | turtle.select(9) |
| 61 | + | |
| 62 | - | turtle.placeDown() |
| 62 | + | |
| 63 | - | turtle.back() |
| 63 | + | |
| 64 | - | turtle.select(10) |
| 64 | + | |
| 65 | - | turtle.place() |
| 65 | + | |
| 66 | - | turtle.turnLeft() |
| 66 | + | |
| 67 | - | turtle.turnLeft() |
| 67 | + | |
| 68 | - | turtle.forward() |
| 68 | + | |
| 69 | - | turtle.select(9) |
| 69 | + | |
| 70 | - | turtle.placeDown() |
| 70 | + | placelmf() |
| 71 | - | turtle.back() |
| 71 | + | |
| 72 | - | turtle.select(10) |
| 72 | + | turtle.turnLeft() |
| 73 | - | turtle.place() |
| 73 | + | |
| 74 | - | turtle.turnRight() |
| 74 | + | |
| 75 | - | end |
| 75 | + | |
| 76 | putblockdown() | |
| 77 | turtle.forward() | |
| 78 | i = i + 1 | |
| 79 | end | |
| 80 | ||
| 81 | placelmb() | |
| 82 | backhome() | |
| 83 | turtle.turnLeft() | |
| 84 | turtle.forward() | |
| 85 | ||
| 86 | local i = 0 | |
| 87 | while i < length do | |
| 88 | - | -- and build a bridge with |
| 88 | + | |
| 89 | - | -- blocks provided in slot 9 |
| 89 | + | |
| 90 | end | |
| 91 | ||
| 92 | placelmf() | |
| 93 | backhome() | |
| 94 | ||
| 95 | -- That's all, folks! | |
| 96 | print("Quarry setup")
| |
| 97 | - | placelm() |
| 97 | + |