SHOW:
|
|
- or go back to the newest paste.
| 1 | - | iforward = 10 |
| 1 | + | local version = "2.1.2" |
| 2 | - | isides = 10 |
| 2 | + | local length = 15--length of the tunnels, configure-able |
| 3 | - | idown = 5 |
| 3 | + | local levels = 0--amount of layers/levels the turtle does, default 1 (these are extra levels) |
| 4 | - | iinitial = 1 |
| 4 | + | local space = 16--inventory size of the turtle |
| 5 | local spaceused = 0--unnecessary to know:P | |
| 6 | - | while iinitial > 0 do |
| 6 | + | local levelsdone = 0--speaks for itself |
| 7 | - | turtle.forward() |
| 7 | + | local returnlength = 0--how far the return path is |
| 8 | - | turtle.digDown() |
| 8 | + | |
| 9 | - | turtle.down() |
| 9 | + | local function clear() --clears the terminal |
| 10 | - | iinitial = iinitial - 1 |
| 10 | + | term.clear() |
| 11 | term.setCursorPos(1,1) | |
| 12 | end | |
| 13 | - | while idown > 0 do |
| 13 | + | |
| 14 | - | while isides > 0 do |
| 14 | + | local function dig() --anti gravel/sand |
| 15 | - | while iforward > 0 do |
| 15 | + | if turtle.detect() == true then |
| 16 | - | turtle.dig() |
| 16 | + | repeat |
| 17 | - | turtle.forward() |
| 17 | + | turtle.dig() |
| 18 | - | iforward = iforward - 1 |
| 18 | + | sleep(0.25) -- small sleep to allow for gravel/sand to fall. |
| 19 | - | end |
| 19 | + | until turtle.detect() == false |
| 20 | - | turtle.turnLeft() |
| 20 | + | end |
| 21 | - | turtle.dig() |
| 21 | + | |
| 22 | - | turtle.forward() |
| 22 | + | |
| 23 | - | turtle.turnLeft() |
| 23 | + | local function forrward() --anti player/mobs blocking and also random respawnd or placed blocks |
| 24 | - | isides = isides - 1 |
| 24 | + | if turtle.detect() == true then |
| 25 | - | iforward = iforward + 10 |
| 25 | + | dig() |
| 26 | - | end |
| 26 | + | sleep(0.25) |
| 27 | - | idown = 0 |
| 27 | + | end |
| 28 | - | end |
| 28 | + | if turtle.forward() == false then |
| 29 | repeat | |
| 30 | turtle.attack() | |
| 31 | sleep(0.25) | |
| 32 | until turtle.forward() == true | |
| 33 | end | |
| 34 | end | |
| 35 | ||
| 36 | local function downn() --anti player/mobs blocking | |
| 37 | if turtle.down() == false then | |
| 38 | repeat | |
| 39 | turtle.attackDown() | |
| 40 | sleep(0.25) | |
| 41 | until turtle.down() == true | |
| 42 | end | |
| 43 | end | |
| 44 | ||
| 45 | local function returntochest() --drops stuff into chest | |
| 46 | for i = 1, levelsdone do | |
| 47 | for i = 1, 5 do | |
| 48 | turtle.up() | |
| 49 | end | |
| 50 | end | |
| 51 | for i = 1, space do | |
| 52 | turtle.select(i) | |
| 53 | turtle.dropUp() | |
| 54 | end | |
| 55 | --if levelsdone ~= levels then | |
| 56 | for i = 1, levelsdone do | |
| 57 | for i = 1, 5 do | |
| 58 | downn() | |
| 59 | end | |
| 60 | end | |
| 61 | --end | |
| 62 | end | |
| 63 | ||
| 64 | local function nextlevel()--Creating the shaft for the next layer | |
| 65 | downn() | |
| 66 | turtle.digDown() | |
| 67 | downn() | |
| 68 | turtle.digDown() | |
| 69 | for i = 1, 2 do | |
| 70 | dig() | |
| 71 | forrward() | |
| 72 | turtle.digDown() | |
| 73 | turtle.turnLeft() | |
| 74 | end | |
| 75 | for i = 1, 3 do | |
| 76 | dig() | |
| 77 | forrward() | |
| 78 | turtle.digDown() | |
| 79 | dig() | |
| 80 | forrward() | |
| 81 | turtle.digDown() | |
| 82 | turtle.turnLeft() | |
| 83 | end | |
| 84 | forrward() | |
| 85 | turtle.turnLeft() | |
| 86 | forrward() | |
| 87 | downn() | |
| 88 | turtle.digDown() | |
| 89 | downn() | |
| 90 | turtle.digDown() | |
| 91 | downn() | |
| 92 | end | |
| 93 | ||
| 94 | local function centerlane() --the function that mines the lines/lanes/shafts | |
| 95 | dig() | |
| 96 | forrward() | |
| 97 | turtle.digUp() | |
| 98 | turtle.digDown() | |
| 99 | turtle.turnLeft() | |
| 100 | dig() | |
| 101 | forrward() | |
| 102 | turtle.digUp() | |
| 103 | turtle.digDown() | |
| 104 | turtle.turnRight() | |
| 105 | turtle.turnRight() | |
| 106 | forrward() | |
| 107 | dig() | |
| 108 | forrward() | |
| 109 | turtle.digUp() | |
| 110 | turtle.digDown() | |
| 111 | turtle.turnLeft() | |
| 112 | turtle.turnLeft() | |
| 113 | forrward() | |
| 114 | turtle.turnRight() | |
| 115 | end | |
| 116 | ||
| 117 | local function centershaft() --the creation of the center | |
| 118 | turtle.digDown() | |
| 119 | dig() | |
| 120 | forrward() | |
| 121 | turtle.digUp() | |
| 122 | turtle.digDown() | |
| 123 | turtle.turnLeft() | |
| 124 | dig() | |
| 125 | forrward() | |
| 126 | turtle.digUp() | |
| 127 | turtle.digDown() | |
| 128 | turtle.turnLeft() | |
| 129 | for i = 1, 3 do | |
| 130 | dig() | |
| 131 | forrward() | |
| 132 | turtle.digUp() | |
| 133 | turtle.digDown() | |
| 134 | dig() | |
| 135 | forrward() | |
| 136 | turtle.digUp() | |
| 137 | turtle.digDown() | |
| 138 | turtle.turnLeft() | |
| 139 | end | |
| 140 | forrward() | |
| 141 | turtle.turnLeft() | |
| 142 | dig() | |
| 143 | forrward() | |
| 144 | turtle.turnRight() | |
| 145 | turtle.turnRight() | |
| 146 | end | |
| 147 | ||
| 148 | local function mining() --Main program, am not going to explain it all here... it mines! | |
| 149 | clear() | |
| 150 | print("How many extra levels?")
| |
| 151 | repeat | |
| 152 | print( "I need a number: " ) | |
| 153 | levels = tonumber( read() ) | |
| 154 | until levels | |
| 155 | print("Is this correct? y/n")
| |
| 156 | print(levels) | |
| 157 | while true do --#loop forever | |
| 158 | local e, char = os.pullEvent( "char" ) | |
| 159 | if char == "y" then | |
| 160 | break | |
| 161 | elseif char == "n" then | |
| 162 | print("Last chance to change it, give new number: ")
| |
| 163 | repeat | |
| 164 | levels = tonumber( read() ) | |
| 165 | until levels | |
| 166 | break --#exit the loop here | |
| 167 | end | |
| 168 | --#if they didn't press y or n, the program will simply wait for another key to be pressed | |
| 169 | end | |
| 170 | clear() | |
| 171 | ||
| 172 | print("Is the center shaft made?") --making the main area shaft
| |
| 173 | print("(y)es or (n)o")
| |
| 174 | while true do --more looooooooops | |
| 175 | local e, char = os.pullEvent( "char" ) | |
| 176 | if char =="n" then | |
| 177 | centershaft() | |
| 178 | break | |
| 179 | elseif char =="y" then | |
| 180 | print("Okiedokie")
| |
| 181 | break | |
| 182 | end | |
| 183 | end | |
| 184 | sleep(2) --little wait before the big | |
| 185 | clear() | |
| 186 | print("Ready to rock!")
| |
| 187 | for i = 1, 4 do | |
| 188 | forrward() | |
| 189 | returnlength = length | |
| 190 | for i = 1, length do | |
| 191 | centerlane() | |
| 192 | end | |
| 193 | turtle.turnLeft() | |
| 194 | turtle.turnLeft() | |
| 195 | forrward() | |
| 196 | for i = 1, returnlength do | |
| 197 | forrward() | |
| 198 | end | |
| 199 | returntochest() | |
| 200 | turtle.turnRight() | |
| 201 | end | |
| 202 | for i = 1, levels do | |
| 203 | nextlevel() | |
| 204 | centershaft() | |
| 205 | levelsdone = levelsdone + 1 | |
| 206 | returntochest() | |
| 207 | for i = 1, 4 do | |
| 208 | forrward() | |
| 209 | returnlength = length | |
| 210 | for i = 1, length do | |
| 211 | centerlane() | |
| 212 | end | |
| 213 | turtle.turnLeft() | |
| 214 | turtle.turnLeft() | |
| 215 | forrward() | |
| 216 | for i = 1, returnlength do | |
| 217 | forrward() | |
| 218 | end | |
| 219 | returntochest() | |
| 220 | turtle.turnRight() | |
| 221 | end | |
| 222 | end | |
| 223 | for i = 1, levelsdone do | |
| 224 | for i = 1, 5 do | |
| 225 | turtle.up() | |
| 226 | end | |
| 227 | end | |
| 228 | ||
| 229 | end | |
| 230 | ||
| 231 | local function inventorycheck() --pre-start emptying inventory + request for torches | |
| 232 | for i = 1, space do | |
| 233 | if turtle.getItemSpace(i) ~= 64 then | |
| 234 | spaceused = spaceused + 1 | |
| 235 | end | |
| 236 | end | |
| 237 | if spaceused ~= 0 then | |
| 238 | for i = 1, space do | |
| 239 | turtle.select(i) | |
| 240 | turtle.dropUp() | |
| 241 | end | |
| 242 | end | |
| 243 | end | |
| 244 | ||
| 245 | local function chestcheck() --checks if there is a chest above it | |
| 246 | local succes, data = turtle.inspectUp() | |
| 247 | turtle.inspectUp() | |
| 248 | if succes == true then | |
| 249 | if data.name == "minecraft:chest" then | |
| 250 | inventorycheck() | |
| 251 | else | |
| 252 | print("Please place a inventory above me. Where I can drop my stuff.")
| |
| 253 | print("Will continue over 5 seconds!")
| |
| 254 | sleep(5) | |
| 255 | inventorycheck() | |
| 256 | end | |
| 257 | end | |
| 258 | end | |
| 259 | chestcheck() | |
| 260 | mining() | |
| 261 | ||
| 262 | print("Made by maxo10/MadJokez")
| |
| 263 | print("Version:"..version)
| |
| 264 | --And thanks KingofGamesYami for some improvements on the script |