SHOW:
|
|
- or go back to the newest paste.
| 1 | tArgs = {...}
| |
| 2 | ||
| 3 | local currentLevel = 0 | |
| 4 | local build = false | |
| 5 | local currentSlot = 1 | |
| 6 | local size = 1 | |
| 7 | ||
| 8 | function isEmpty(slot) | |
| 9 | if turtle.getItemCount(slot) > 0 then | |
| 10 | return false | |
| 11 | else | |
| 12 | return true | |
| 13 | end | |
| 14 | end | |
| 15 | ||
| 16 | function nextSlot() | |
| 17 | currentSlot = currentSlot + 1 | |
| 18 | turtle.select(currentSlot) | |
| 19 | end | |
| 20 | ||
| 21 | function buildColumn() | |
| 22 | while turtle.detectDown() == false do | |
| 23 | turtle.down() | |
| 24 | currentLevel = currentLevel + 1 | |
| 25 | end | |
| 26 | ||
| 27 | if turtle.detectDown() == true then | |
| 28 | for i = 1, currentLevel do | |
| 29 | if isEmpty(currentSlot) == false then | |
| 30 | turtle.up() | |
| 31 | turtle.placeDown() | |
| 32 | else | |
| 33 | nextSlot() | |
| 34 | - | i = i - 1 |
| 34 | + | |
| 35 | turtle.placeDown() | |
| 36 | end | |
| 37 | end | |
| 38 | end | |
| 39 | currentLevel = 0 | |
| 40 | end | |
| 41 | ||
| 42 | function buildTwoByTwo() | |
| 43 | buildColumn() | |
| 44 | turtle.forward() | |
| 45 | buildColumn() | |
| 46 | turtle.turnLeft() | |
| 47 | turtle.forward() | |
| 48 | buildColumn() | |
| 49 | turtle.turnLeft() | |
| 50 | turtle.forward() | |
| 51 | buildColumn() | |
| 52 | turtle.turnLeft() | |
| 53 | turtle.forward() | |
| 54 | print("DONE")
| |
| 55 | end | |
| 56 | ||
| 57 | function buildThreeByThree() | |
| 58 | buildColumn() | |
| 59 | turtle.forward() | |
| 60 | buildColumn() | |
| 61 | turtle.forward() | |
| 62 | buildColumn() | |
| 63 | turtle.turnLeft() | |
| 64 | turtle.forward() | |
| 65 | buildColumn() | |
| 66 | turtle.turnLeft() | |
| 67 | turtle.forward() | |
| 68 | buildColumn() | |
| 69 | turtle.forward() | |
| 70 | buildColumn() | |
| 71 | turtle.turnRight() | |
| 72 | turtle.forward() | |
| 73 | buildColumn() | |
| 74 | turtle.turnRight() | |
| 75 | turtle.forward() | |
| 76 | buildColumn() | |
| 77 | turtle.forward() | |
| 78 | buildColumn() | |
| 79 | turtle.turnRight() | |
| 80 | turtle.turnRight() | |
| 81 | turtle.forward() | |
| 82 | - | turtle.forward() |
| 82 | + | |
| 83 | turtle.forward() | |
| 84 | print("DONE")
| |
| 85 | - | function buildFourByFour() |
| 85 | + | |
| 86 | - | -- |
| 86 | + | |
| 87 | if tArgs[1] == nil then | |
| 88 | print("Building a 1 x 1 column")
| |
| 89 | build = true | |
| 90 | else | |
| 91 | if tArgs[1 == "2" or tArgs[1] == "3" then | |
| 92 | build = true | |
| 93 | - | if tArgs[1 == "2" or tArgs[1] == "3" or tArgs[1] == "4" then |
| 93 | + | |
| 94 | else | |
| 95 | print("Invalid Usage.")
| |
| 96 | print("Usage:")
| |
| 97 | print("column")
| |
| 98 | print("column size")
| |
| 99 | print(" ")
| |
| 100 | print("Valid column sizes: (2) = 2 x 2, (3) = 3 x 3, (4) = 4 x 4")
| |
| 101 | end | |
| 102 | end | |
| 103 | ||
| 104 | if build == true then | |
| 105 | if size == 1 then | |
| 106 | buildColumn() | |
| 107 | print("DONE")
| |
| 108 | elseif size == 2 then | |
| 109 | buildTwoByTwo() | |
| 110 | elseif size == 3 then | |
| 111 | buildThreeByThree() | |
| 112 | end | |
| 113 | end |