SHOW:
|
|
- or go back to the newest paste.
| 1 | print("Direwolf 9x9 House builder")
| |
| 2 | print("Slots 1-3 = Walls (3 Stacks)")
| |
| 3 | print("Slot 4 = Floor (49 blocks)")
| |
| 4 | print("Slot 5 = Ceiling Middle (33 blocks)")
| |
| 5 | print("Slot 6 = Glass (16 blocks)")
| |
| 6 | print("Press Enter to begin")
| |
| 7 | ||
| 8 | io.read() | |
| 9 | ||
| 10 | function column() | |
| 11 | for i=1,8,1 do | |
| 12 | turtle.dig() | |
| 13 | turtle.forward() | |
| 14 | end | |
| 15 | end | |
| 16 | ||
| 17 | function repeat1() | |
| 18 | column() | |
| 19 | turtle.turnLeft() | |
| 20 | turtle.dig() | |
| 21 | turtle.forward() | |
| 22 | turtle.turnLeft() | |
| 23 | end | |
| 24 | ||
| 25 | function repeat2() | |
| 26 | column() | |
| 27 | turtle.turnRight() | |
| 28 | turtle.dig() | |
| 29 | turtle.forward() | |
| 30 | turtle.turnRight() | |
| 31 | end | |
| 32 | ||
| 33 | function goback() | |
| 34 | turtle.back() | |
| 35 | turtle.back() | |
| 36 | turtle.back() | |
| 37 | turtle.back() | |
| 38 | turtle.back() | |
| 39 | turtle.back() | |
| 40 | turtle.back() | |
| 41 | turtle.back() | |
| 42 | turtle.turnLeft() | |
| 43 | turtle.back() | |
| 44 | turtle.back() | |
| 45 | turtle.back() | |
| 46 | turtle.back() | |
| 47 | turtle.back() | |
| 48 | turtle.back() | |
| 49 | turtle.back() | |
| 50 | turtle.back() | |
| 51 | turtle.turnRight() | |
| 52 | end | |
| 53 | ||
| 54 | function dig() | |
| 55 | for i=1,6,1 do | |
| 56 | repeat1() | |
| 57 | repeat2() | |
| 58 | repeat1() | |
| 59 | repeat2() | |
| 60 | repeat1() | |
| 61 | repeat2() | |
| 62 | repeat1() | |
| 63 | repeat2() | |
| 64 | column() | |
| 65 | goback() | |
| 66 | turtle.digUp() | |
| 67 | turtle.up() | |
| 68 | end | |
| 69 | end | |
| 70 | ||
| 71 | function down() | |
| 72 | turtle.down() | |
| 73 | turtle.down() | |
| 74 | turtle.down() | |
| 75 | turtle.down() | |
| 76 | turtle.down() | |
| 77 | end | |
| 78 | ||
| 79 | function layer() | |
| 80 | for i=1,9,1 do | |
| 81 | turtle.placeDown() | |
| 82 | if turtle.getItemCount(1)==0 then | |
| 83 | turtle.select(2) | |
| 84 | if (turtle.getItemCount(2))==0 then | |
| 85 | turtle.select(3) | |
| 86 | end | |
| 87 | end | |
| 88 | if turtle.detect() then | |
| 89 | turtle.dig() | |
| 90 | end | |
| 91 | turtle.forward() | |
| 92 | end | |
| 93 | end | |
| 94 | ||
| 95 | function wall() | |
| 96 | for i=1,6,1 do | |
| 97 | layer() | |
| 98 | for i=1,9,1 do | |
| 99 | turtle.back() | |
| 100 | end | |
| 101 | turtle.up() | |
| 102 | end | |
| 103 | end | |
| 104 | ||
| 105 | function switch() | |
| 106 | turtle.turnLeft() | |
| 107 | turtle.forward() | |
| 108 | turtle.forward() | |
| 109 | turtle.forward() | |
| 110 | turtle.forward() | |
| 111 | turtle.forward() | |
| 112 | turtle.forward() | |
| 113 | turtle.forward() | |
| 114 | turtle.forward() | |
| 115 | turtle.turnRight() | |
| 116 | turtle.down() | |
| 117 | turtle.down() | |
| 118 | turtle.down() | |
| 119 | turtle.down() | |
| 120 | turtle.down() | |
| 121 | turtle.down() | |
| 122 | end | |
| 123 | ||
| 124 | function switch2() | |
| 125 | for i=1,8,1 do | |
| 126 | turtle.forward() | |
| 127 | end | |
| 128 | turtle.turnRight() | |
| 129 | turtle.forward() | |
| 130 | down() | |
| 131 | turtle.down() | |
| 132 | end | |
| 133 | ||
| 134 | function layer2() | |
| 135 | for i=1,6,1 do | |
| 136 | if turtle.getItemCount(1)==0 then | |
| 137 | turtle.select(2) | |
| 138 | if turtle.getItemCount(2)==0 then | |
| 139 | turtle.select(3) | |
| 140 | end | |
| 141 | end | |
| 142 | turtle.placeDown() | |
| 143 | turtle.forward() | |
| 144 | end | |
| 145 | if turtle.getItemCount(1)==0 then | |
| 146 | turtle.select(2) | |
| 147 | if turtle.getItemCount(2)==0 then | |
| 148 | turtle.select(3) | |
| 149 | end | |
| 150 | end | |
| 151 | turtle.placeDown() | |
| 152 | end | |
| 153 | ||
| 154 | function wall2() | |
| 155 | for i=1,6,1 do | |
| 156 | layer2() | |
| 157 | turtle.back() | |
| 158 | turtle.back() | |
| 159 | turtle.back() | |
| 160 | turtle.back() | |
| 161 | turtle.back() | |
| 162 | turtle.back() | |
| 163 | turtle.up() | |
| 164 | end | |
| 165 | end | |
| 166 | ||
| 167 | function switch3() | |
| 168 | turtle.turnRight() | |
| 169 | for i=1,8,1 do | |
| 170 | turtle.forward() | |
| 171 | end | |
| 172 | turtle.turnRight() | |
| 173 | down() | |
| 174 | turtle.down() | |
| 175 | turtle.back() | |
| 176 | turtle.back() | |
| 177 | turtle.back() | |
| 178 | turtle.back() | |
| 179 | turtle.back() | |
| 180 | turtle.back() | |
| 181 | end | |
| 182 | ||
| 183 | function midwall() | |
| 184 | switch2() | |
| 185 | wall2() | |
| 186 | switch3() | |
| 187 | wall2() | |
| 188 | end | |
| 189 | ||
| 190 | function longwall() | |
| 191 | wall() | |
| 192 | switch() | |
| 193 | wall() | |
| 194 | end | |
| 195 | ||
| 196 | function wall1() | |
| 197 | down() | |
| 198 | longwall() | |
| 199 | midwall() | |
| 200 | end | |
| 201 | ||
| 202 | function oline() | |
| 203 | turtle.select(5) | |
| 204 | for i=1,6,1 do | |
| 205 | turtle.placeDown() | |
| 206 | turtle.forward() | |
| 207 | end | |
| 208 | end | |
| 209 | ||
| 210 | function move() | |
| 211 | for i=1,3,1 do | |
| 212 | turtle.forward() | |
| 213 | end | |
| 214 | end | |
| 215 | ||
| 216 | function mline() | |
| 217 | move() | |
| 218 | turtle.turnLeft() | |
| 219 | oline() | |
| 220 | for i=1,2,1 do | |
| 221 | turtle.turnLeft() | |
| 222 | move() | |
| 223 | end | |
| 224 | turtle.turnLeft() | |
| 225 | oline() | |
| 226 | end | |
| 227 | ||
| 228 | function ceiling() | |
| 229 | turtle.turnRight() | |
| 230 | turtle.forward() | |
| 231 | turtle.down() | |
| 232 | for i=1,4,1 do | |
| 233 | oline() | |
| 234 | turtle.turnLeft() | |
| 235 | end | |
| 236 | mline() | |
| 237 | end | |
| 238 | ||
| 239 | function glassl() | |
| 240 | for i=1,2,1 do | |
| 241 | turtle.forward() | |
| 242 | turtle.placeDown() | |
| 243 | end | |
| 244 | turtle.forward() | |
| 245 | for i=1,2,1 do | |
| 246 | turtle.forward() | |
| 247 | turtle.placeDown() | |
| 248 | end | |
| 249 | end | |
| 250 | ||
| 251 | function glass() | |
| 252 | turtle.select(6) | |
| 253 | turtle.turnLeft() | |
| 254 | turtle.forward() | |
| 255 | turtle.forward() | |
| 256 | turtle.turnLeft() | |
| 257 | glassl() | |
| 258 | for i=1,2,1 do | |
| 259 | turtle.forward() | |
| 260 | turtle.turnLeft() | |
| 261 | end | |
| 262 | glassl() | |
| 263 | turtle.forward() | |
| 264 | turtle.turnRight() | |
| 265 | turtle.forward() | |
| 266 | turtle.forward() | |
| 267 | turtle.turnRight() | |
| 268 | glassl() | |
| 269 | for i=1,2,1 do | |
| 270 | turtle.forward() | |
| 271 | turtle.turnLeft() | |
| 272 | end | |
| 273 | turtle.forward() | |
| 274 | turtle.down() | |
| 275 | turtle.down() | |
| 276 | for i=1,2,1 do | |
| 277 | turtle.placeUp() | |
| 278 | turtle.forward() | |
| 279 | end | |
| 280 | turtle.forward() | |
| 281 | for i=1,2,1 do | |
| 282 | turtle.placeUp() | |
| 283 | turtle.forward() | |
| 284 | end | |
| 285 | end | |
| 286 | ||
| 287 | function gotofloor() | |
| 288 | turtle.turnRight() | |
| 289 | turtle.forward() | |
| 290 | for i=1,4,1 do | |
| 291 | turtle.down() | |
| 292 | end | |
| 293 | turtle.turnRight() | |
| 294 | end | |
| 295 | ||
| 296 | function floorline() | |
| 297 | for i=1,6,1 do | |
| 298 | turtle.digDown() | |
| 299 | turtle.placeDown() | |
| 300 | turtle.forward() | |
| 301 | end | |
| 302 | turtle.digDown() | |
| 303 | turtle.placeDown() | |
| 304 | end | |
| 305 | ||
| 306 | function floorRight() | |
| 307 | floorline() | |
| 308 | turtle.turnRight() | |
| 309 | turtle.forward() | |
| 310 | turtle.turnRight() | |
| 311 | end | |
| 312 | ||
| 313 | function floorLeft() | |
| 314 | floorline() | |
| 315 | turtle.turnLeft() | |
| 316 | turtle.forward() | |
| 317 | turtle.turnLeft() | |
| 318 | end | |
| 319 | ||
| 320 | function floor() | |
| 321 | turtle.select(4) | |
| 322 | gotofloor() | |
| 323 | for i=1,3,1 do | |
| 324 | floorRight() | |
| 325 | floorLeft() | |
| 326 | end | |
| 327 | floorline() | |
| 328 | end | |
| 329 | ||
| 330 | function finish() | |
| 331 | turtle.turnLeft() | |
| 332 | turtle.turnLeft() | |
| 333 | move() | |
| 334 | turtle.turnRight() | |
| 335 | move() | |
| 336 | turtle.turnRight() | |
| 337 | end | |
| 338 | ||
| 339 | turtle.select(1) | |
| 340 | dig() | |
| 341 | wall1() | |
| 342 | ceiling() | |
| 343 | glass() | |
| 344 | floor() | |
| 345 | finish() |