SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --[[ |
| 1 | + | print("Direwolf20's 9x9 House builder")
|
| 2 | - | Author |
| 2 | + | print("Slots 1-3 = Walls (?? Stacks)")
|
| 3 | - | Rasmus Sommer aka. TheSommer |
| 3 | + | print("Slot 4 = Floor (?? blocks)")
|
| 4 | - | youtube.com/thesommersmc |
| 4 | + | print("Slot 5 = Ceiling Middle (?? blocks)")
|
| 5 | - | twitch.tv/thesommer |
| 5 | + | print("Slot 6 = Glass (16 blocks)")
|
| 6 | - | |
| 6 | + | |
| 7 | - | How to use: |
| 7 | + | |
| 8 | - | Slot 1 - Fuel |
| 8 | + | |
| 9 | - | Slot 2 - Bridge material |
| 9 | + | |
| 10 | - | Slot 3 - Torches |
| 10 | + | |
| 11 | - | |
| 11 | + | local function checkCount(slot) |
| 12 | - | torchedtunnel <length> |
| 12 | + | if turtle.getItemCount(slot) == 0 then |
| 13 | - | --]] |
| 13 | + | slot = slot + 1 |
| 14 | turtle.select(slot) | |
| 15 | - | local tArgs = { ... }
|
| 15 | + | return slot |
| 16 | - | if #tArgs ~= 1 then |
| 16 | + | end |
| 17 | - | print( "Usage: torchedtunnel <length>" ) |
| 17 | + | return slot |
| 18 | - | return |
| 18 | + | |
| 19 | ||
| 20 | local function tryRefuel(slot) | |
| 21 | - | local length = tonumber( tArgs[1] ) |
| 21 | + | if turtle.getFuelLevel() <= 5 then |
| 22 | - | if length < 1 then |
| 22 | + | turtle.select(16) |
| 23 | - | print( "Tunnel length must be positive" ) |
| 23 | + | turtle.refuel(4) |
| 24 | - | return |
| 24 | + | turtle.select(slot) |
| 25 | ||
| 26 | end | |
| 27 | - | local function tryRefuel() |
| 27 | + | |
| 28 | - | if turtle.getFuelLevel() == 0 then |
| 28 | + | |
| 29 | - | turtle.select(1) |
| 29 | + | local function floor(slot) |
| 30 | - | turtle.refuel(1) |
| 30 | + | --Does 4 passes. One up and one down for 8 rows. |
| 31 | --Leaves the 9th row empty to start the walls | |
| 32 | turtle.select(slot) --Selects cobble for floor | |
| 33 | for j = 0, 3 do | |
| 34 | - | local function tryDig() |
| 34 | + | for i = 0, 8 do --Does one row up and another back |
| 35 | - | while turtle.detect() == true do |
| 35 | + | tryRefuel(slot) |
| 36 | - | turtle.dig() |
| 36 | + | slot = checkCount(slot) |
| 37 | - | sleep(0.5) |
| 37 | + | turtle.placeDown() |
| 38 | turtle.forward() | |
| 39 | end | |
| 40 | turtle.turnRight() | |
| 41 | - | local function tryDigUp() |
| 41 | + | turtle.forward() |
| 42 | - | while turtle.detectUp() == true do |
| 42 | + | turtle.turnRight() |
| 43 | - | turtle.digUp() |
| 43 | + | turtle.forward() |
| 44 | - | sleep(0.5) |
| 44 | + | for i = 0, 8 do |
| 45 | tryRefuel(slot) | |
| 46 | slot = checkCount(slot) | |
| 47 | turtle.placeDown() | |
| 48 | - | local function tryUp() |
| 48 | + | turtle.forward() |
| 49 | - | tryDigUp() |
| 49 | + | end |
| 50 | - | tryRefuel() |
| 50 | + | turtle.turnLeft() |
| 51 | - | turtle.up() |
| 51 | + | turtle.forward() |
| 52 | turtle.turnLeft() | |
| 53 | turtle.forward() | |
| 54 | - | local function tryDown() |
| 54 | + | end |
| 55 | - | while turtle.detectDown() == true do |
| 55 | + | return(slot) |
| 56 | - | turtle.digDown() |
| 56 | + | |
| 57 | - | sleep(0.5) |
| 57 | + | |
| 58 | ||
| 59 | - | tryRefuel() |
| 59 | + | local function walls(slot) |
| 60 | - | turtle.down() |
| 60 | + | --Starts on the last row of the floors as the first wall |
| 61 | ||
| 62 | for j = 0, 8 do | |
| 63 | - | local function tryForward() |
| 63 | + | --places 6 blocks up on the first wall missing the floor |
| 64 | - | tryDig() |
| 64 | + | for i = 0, 6 do |
| 65 | - | tryRefuel() |
| 65 | + | tryRefuel(slot) |
| 66 | - | turtle.forward() |
| 66 | + | slot = checkCount(slot) |
| 67 | turtle.placeDown() | |
| 68 | turtle.up() | |
| 69 | - | local function makeBridge() |
| 69 | + | end |
| 70 | - | if turtle.detectDown() == false then |
| 70 | + | turtle.forward() |
| 71 | - | turtle.select(2) |
| 71 | + | for i = 0, 6 do |
| 72 | - | turtle.placeDown() |
| 72 | + | tryRefuel(slot) |
| 73 | slot = checkCount(slot) | |
| 74 | turtle.down() | |
| 75 | end | |
| 76 | - | local count = 1 |
| 76 | + | end |
| 77 | -- places it back onto the floor for the second wall. | |
| 78 | - | for i = 1, length do |
| 78 | + | -- possibly loop this twice and finish with a seperate door piece? |
| 79 | - | tryForward() |
| 79 | + | for k = 0, 1 do |
| 80 | - | makeBridge() |
| 80 | + | turtle.turnLeft() |
| 81 | - | tryDigUp() |
| 81 | + | turtle.forward() |
| 82 | - | turtle.turnLeft() |
| 82 | + | turtle.turnLeft() |
| 83 | - | tryDig() |
| 83 | + | turtle.forward() |
| 84 | - | tryUp() |
| 84 | + | turtle.turnRight() |
| 85 | - | tryDig() |
| 85 | + | for j = 0, 7 do |
| 86 | - | if count % 8 == 0 then |
| 86 | + | --places 5 blocks up from the floor |
| 87 | - | turtle.select(3) |
| 87 | + | for i = 0, 6 do |
| 88 | - | turtle.place() |
| 88 | + | tryRefuel(slot) |
| 89 | slot = checkCount(slot) | |
| 90 | - | turtle.turnRight() |
| 90 | + | turtle.placeDown() |
| 91 | - | turtle.turnRight() |
| 91 | + | turtle.up() |
| 92 | - | tryDig() |
| 92 | + | end |
| 93 | - | tryDown() |
| 93 | + | turtle.forward() |
| 94 | - | tryDig() |
| 94 | + | for i = 0, 6 do |
| 95 | - | turtle.turnLeft() |
| 95 | + | tryRefuel(slot) |
| 96 | - | count = count + 1 |
| 96 | + | slot = checkCount(slot) |
| 97 | - | end |
| 97 | + | turtle.down() |
| 98 | end | |
| 99 | end | |
| 100 | end | |
| 101 | turtle.turnLeft() | |
| 102 | turtle.forward() | |
| 103 | turtle.turnLeft() | |
| 104 | turtle.forward() | |
| 105 | turtle.turnRight() | |
| 106 | --Last wall with the door does a column of 3 then a door then repeats | |
| 107 | for j = 0, 2 do | |
| 108 | --places 5 blocks up from the floor | |
| 109 | for i = 0, 6 do | |
| 110 | tryRefuel(slot) | |
| 111 | slot = checkCount(slot) | |
| 112 | turtle.placeDown() | |
| 113 | turtle.up() | |
| 114 | end | |
| 115 | turtle.forward() | |
| 116 | for i = 0, 6 do | |
| 117 | tryRefuel(slot) | |
| 118 | slot = checkCount(slot) | |
| 119 | turtle.down() | |
| 120 | end | |
| 121 | end | |
| 122 | --------------------- | |
| 123 | --Door is placed here | |
| 124 | turtle.up() | |
| 125 | turtle.up() | |
| 126 | --------------------- | |
| 127 | for i = 0, 4 do | |
| 128 | tryRefuel(slot) | |
| 129 | slot = checkCount(slot) | |
| 130 | turtle.placeDown() | |
| 131 | turtle.up() | |
| 132 | end | |
| 133 | turtle.forward() | |
| 134 | for i = 0, 6 do | |
| 135 | tryRefuel(slot) | |
| 136 | slot = checkCount(slot) | |
| 137 | turtle.down() | |
| 138 | end | |
| 139 | ||
| 140 | ||
| 141 | --Finished out the row of columns | |
| 142 | for j = 0, 2 do | |
| 143 | --places 5 blocks up from the floor | |
| 144 | for i = 0, 6 do | |
| 145 | tryRefuel(slot) | |
| 146 | slot = checkCount(slot) | |
| 147 | turtle.placeDown() | |
| 148 | turtle.up() | |
| 149 | end | |
| 150 | turtle.forward() | |
| 151 | for i = 0, 6 do | |
| 152 | tryRefuel(slot) | |
| 153 | slot = checkCount(slot) | |
| 154 | turtle.down() | |
| 155 | end | |
| 156 | end | |
| 157 | ||
| 158 | end | |
| 159 | ||
| 160 | local function roof(slot) | |
| 161 | turtle.turnLeft() | |
| 162 | turtle.forward() | |
| 163 | turtle.turnLeft() | |
| 164 | turtle.forward() | |
| 165 | print("enter loop")
| |
| 166 | for j = 0, 2 do | |
| 167 | for i = 0, 8 do | |
| 168 | tryRefuel(slot) | |
| 169 | slot = checkCount(slot) | |
| 170 | turtle.placeDown() | |
| 171 | print("place down")
| |
| 172 | turtle.forward() | |
| 173 | print("forward")
| |
| 174 | end | |
| 175 | turtle.turnRight() | |
| 176 | turtle.forward() | |
| 177 | turtle.turnRight() | |
| 178 | for i = 0, 8 do | |
| 179 | tryRefuel(slot) | |
| 180 | slot = checkCount(slot) | |
| 181 | turtle.placeDown() | |
| 182 | turtle.forward() | |
| 183 | end | |
| 184 | turtle.turnLeft() | |
| 185 | turtle.forward() | |
| 186 | turtle.turnLeft() | |
| 187 | end | |
| 188 | for i = 0, 8 do | |
| 189 | tryRefuel(slot) | |
| 190 | slot = checkCount(slot) | |
| 191 | turtle.placeDown() | |
| 192 | turtle.forward() | |
| 193 | end | |
| 194 | ||
| 195 | end | |
| 196 | ||
| 197 | --Control Section | |
| 198 | --Starts with slot 1 for cobble | |
| 199 | local function control() | |
| 200 | slot = 1 | |
| 201 | tryRefuel(slot) | |
| 202 | slot = checkCount(slot) | |
| 203 | -- turtle.up() | |
| 204 | -- floor(slot) | |
| 205 | -- walls(slot) | |
| 206 | roof(slot) | |
| 207 | end | |
| 208 | ||
| 209 | control() |