SHOW:
|
|
- or go back to the newest paste.
| 1 | - | print("Direwolf20's 9x9 House builder")
|
| 1 | + | --[[ |
| 2 | - | print("Slots 1-3 = Walls (?? Stacks)")
|
| 2 | + | Original Author |
| 3 | - | print("Slot 4 = Floor (?? blocks)")
|
| 3 | + | Rasmus Sommer aka. TheSommer |
| 4 | - | print("Slot 5 = Ceiling Middle (?? blocks)")
|
| 4 | + | youtube.com/thesommersmc |
| 5 | - | print("Slot 6 = Glass (16 blocks)")
|
| 5 | + | twitch.tv/thesommer |
| 6 | Edited by Mjmac85 | |
| 7 | ||
| 8 | How to use: | |
| 9 | Slot 1 - Fuel | |
| 10 | Slot 2 - Bridge material | |
| 11 | - | local function checkCount(slot) |
| 11 | + | Slot 3 - Torches |
| 12 | - | if turtle.getItemCount(slot) == 0 then |
| 12 | + | |
| 13 | - | slot = slot + 1 |
| 13 | + | Edit:Place chest directly behind the turtle at the start point. |
| 14 | - | turtle.select(slot) |
| 14 | + | |
| 15 | - | return slot |
| 15 | + | torchedtunnel <length> |
| 16 | --]] | |
| 17 | - | return slot |
| 17 | + | |
| 18 | local tArgs = { ... }
| |
| 19 | if #tArgs ~= 1 then | |
| 20 | - | local function tryRefuel(slot) |
| 20 | + | print( "Usage: torchedtunnel <length>" ) |
| 21 | - | if turtle.getFuelLevel() <= 5 then |
| 21 | + | return |
| 22 | - | turtle.select(16) |
| 22 | + | |
| 23 | - | turtle.refuel(4) |
| 23 | + | |
| 24 | - | turtle.select(slot) |
| 24 | + | local length = tonumber( tArgs[1] ) |
| 25 | if length < 1 then | |
| 26 | print( "Tunnel length must be positive" ) | |
| 27 | return | |
| 28 | end | |
| 29 | - | local function floor(slot) |
| 29 | + | |
| 30 | - | --Does 4 passes. One up and one down for 8 rows. |
| 30 | + | local function tryRefuel() |
| 31 | - | --Leaves the 9th row empty to start the walls |
| 31 | + | if turtle.getFuelLevel() == 0 then |
| 32 | - | turtle.select(slot) --Selects cobble for floor |
| 32 | + | turtle.select(1) |
| 33 | - | for j = 0, 3 do |
| 33 | + | turtle.refuel(1) |
| 34 | - | for i = 0, 8 do --Does one row up and another back |
| 34 | + | |
| 35 | - | tryRefuel(slot) |
| 35 | + | |
| 36 | - | slot = checkCount(slot) |
| 36 | + | |
| 37 | - | turtle.placeDown() |
| 37 | + | local function tryDig() |
| 38 | - | turtle.forward() |
| 38 | + | while turtle.detect() == true do |
| 39 | - | end |
| 39 | + | turtle.dig() |
| 40 | - | turtle.turnRight() |
| 40 | + | sleep(0.5) |
| 41 | - | turtle.forward() |
| 41 | + | |
| 42 | - | turtle.turnRight() |
| 42 | + | |
| 43 | - | turtle.forward() |
| 43 | + | |
| 44 | - | for i = 0, 8 do |
| 44 | + | local function tryDigUp() |
| 45 | - | tryRefuel(slot) |
| 45 | + | while turtle.detectUp() == true do |
| 46 | - | slot = checkCount(slot) |
| 46 | + | turtle.digUp() |
| 47 | - | turtle.placeDown() |
| 47 | + | sleep(0.5) |
| 48 | - | turtle.forward() |
| 48 | + | |
| 49 | - | end |
| 49 | + | |
| 50 | - | turtle.turnLeft() |
| 50 | + | |
| 51 | - | turtle.forward() |
| 51 | + | local function tryUp() |
| 52 | - | turtle.turnLeft() |
| 52 | + | tryDigUp() |
| 53 | - | turtle.forward() |
| 53 | + | tryRefuel() |
| 54 | turtle.up() | |
| 55 | - | return(slot) |
| 55 | + | |
| 56 | ||
| 57 | local function tryDown() | |
| 58 | while turtle.detectDown() == true do | |
| 59 | - | local function walls(slot) |
| 59 | + | turtle.digDown() |
| 60 | - | --Starts on the last row of the floors as the first wall |
| 60 | + | sleep(0.5) |
| 61 | - | |
| 61 | + | |
| 62 | - | for j = 0, 8 do |
| 62 | + | tryRefuel() |
| 63 | - | --places 6 blocks up on the first wall missing the floor |
| 63 | + | turtle.down() |
| 64 | - | for i = 0, 6 do |
| 64 | + | |
| 65 | - | tryRefuel(slot) |
| 65 | + | |
| 66 | - | slot = checkCount(slot) |
| 66 | + | local function tryForward() |
| 67 | - | turtle.placeDown() |
| 67 | + | tryDig() |
| 68 | - | turtle.up() |
| 68 | + | tryRefuel() |
| 69 | - | end |
| 69 | + | turtle.forward() |
| 70 | - | turtle.forward() |
| 70 | + | |
| 71 | - | for i = 0, 6 do |
| 71 | + | |
| 72 | - | tryRefuel(slot) |
| 72 | + | local function makeBridge() |
| 73 | - | slot = checkCount(slot) |
| 73 | + | if turtle.detectDown() == false then |
| 74 | - | turtle.down() |
| 74 | + | turtle.select(2) |
| 75 | - | end |
| 75 | + | turtle.placeDown() |
| 76 | end | |
| 77 | - | -- places it back onto the floor for the second wall. |
| 77 | + | |
| 78 | - | -- possibly loop this twice and finish with a seperate door piece? |
| 78 | + | |
| 79 | - | for k = 0, 1 do |
| 79 | + | local count = 1 |
| 80 | - | turtle.turnLeft() |
| 80 | + | |
| 81 | - | turtle.forward() |
| 81 | + | --Emptys inventory into a chest |
| 82 | - | turtle.turnLeft() |
| 82 | + | local function dropItems() |
| 83 | - | turtle.forward() |
| 83 | + | local invCount = 4 |
| 84 | - | turtle.turnRight() |
| 84 | + | for invCount = 4, 16 do |
| 85 | - | for j = 0, 7 do |
| 85 | + | turtle.select(invCount) |
| 86 | - | --places 5 blocks up from the floor |
| 86 | + | turtle.drop() |
| 87 | - | for i = 0, 6 do |
| 87 | + | |
| 88 | - | tryRefuel(slot) |
| 88 | + | turtle.select(4) |
| 89 | - | slot = checkCount(slot) |
| 89 | + | |
| 90 | - | turtle.placeDown() |
| 90 | + | |
| 91 | - | turtle.up() |
| 91 | + | |
| 92 | - | end |
| 92 | + | --Turns the turtle around calls dropItems and goes back to mining |
| 93 | - | turtle.forward() |
| 93 | + | local function returnTrip(count) |
| 94 | - | for i = 0, 6 do |
| 94 | + | |
| 95 | - | tryRefuel(slot) |
| 95 | + | |
| 96 | - | slot = checkCount(slot) |
| 96 | + | for moveCount = 1, count - 1 do |
| 97 | - | turtle.down() |
| 97 | + | tryForward() |
| 98 | - | end |
| 98 | + | |
| 99 | - | end |
| 99 | + | |
| 100 | dropItems() | |
| 101 | turtle.turnLeft() | |
| 102 | - | turtle.forward() |
| 102 | + | |
| 103 | for moveCount = 1, count - 1 do | |
| 104 | - | turtle.forward() |
| 104 | + | tryForward() |
| 105 | end | |
| 106 | - | --Last wall with the door does a column of 3 then a door then repeats |
| 106 | + | |
| 107 | - | for j = 0, 2 do |
| 107 | + | |
| 108 | - | --places 5 blocks up from the floor |
| 108 | + | |
| 109 | - | for i = 0, 6 do |
| 109 | + | for i = 1, length do |
| 110 | - | tryRefuel(slot) |
| 110 | + | --Checks item count and drops if full |
| 111 | - | slot = checkCount(slot) |
| 111 | + | if turtle.getItemCount(16) > 0 then |
| 112 | - | turtle.placeDown() |
| 112 | + | returnTrip(count) |
| 113 | - | turtle.up() |
| 113 | + | |
| 114 | - | end |
| 114 | + | tryForward() |
| 115 | - | turtle.forward() |
| 115 | + | count = count + 1 |
| 116 | - | for i = 0, 6 do |
| 116 | + | makeBridge() |
| 117 | - | tryRefuel(slot) |
| 117 | + | tryDigUp() |
| 118 | - | slot = checkCount(slot) |
| 118 | + | turtle.turnLeft() |
| 119 | - | turtle.down() |
| 119 | + | tryDig() |
| 120 | - | end |
| 120 | + | tryUp() |
| 121 | - | end |
| 121 | + | tryDig() |
| 122 | - | --------------------- |
| 122 | + | --Torches taken out |
| 123 | - | --Door is placed here |
| 123 | + | --if count % 8 == 0 then |
| 124 | - | turtle.up() |
| 124 | + | --turtle.select(3) |
| 125 | - | turtle.up() |
| 125 | + | --turtle.place() |
| 126 | - | --------------------- |
| 126 | + | --end |
| 127 | - | for i = 0, 4 do |
| 127 | + | turtle.turnRight() |
| 128 | - | tryRefuel(slot) |
| 128 | + | turtle.turnRight() |
| 129 | - | slot = checkCount(slot) |
| 129 | + | tryDig() |
| 130 | - | turtle.placeDown() |
| 130 | + | tryDown() |
| 131 | - | turtle.up() |
| 131 | + | tryDig() |
| 132 | - | end |
| 132 | + | turtle.turnLeft() |
| 133 | - | turtle.forward() |
| 133 | + | |
| 134 | - | for i = 0, 6 do |
| 134 | + | |
| 135 | - | tryRefuel(slot) |
| 135 | + | --Takes the turtle back to start point, drops items, and faces forward to start again |
| 136 | - | slot = checkCount(slot) |
| 136 | + | turtle.turnRight() |
| 137 | - | turtle.down() |
| 137 | + | turtle.turnRight() |
| 138 | - | end |
| 138 | + | for i = 1, count - 1 do |
| 139 | - | |
| 139 | + | tryForward() |
| 140 | - | |
| 140 | + | |
| 141 | - | --Finished out the row of columns |
| 141 | + | turtle.turnLeft() |
| 142 | - | for j = 0, 2 do |
| 142 | + | dropItems() |
| 143 | - | --places 5 blocks up from the floor |
| 143 | + | turtle.turnLeft() |
| 144 | - | for i = 0, 6 do |
| 144 | + | print("Finished boss!") |