SHOW:
|
|
- or go back to the newest paste.
| 1 | local args = {...}
| |
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | if not #args == 3 then | |
| 6 | print("Usage: clear <x y z>")
| |
| 7 | return | |
| 8 | end | |
| 9 | - | local x = tonumber(args[1]) - 1 |
| 9 | + | |
| 10 | - | local y = tonumber(args[2]) |
| 10 | + | function checkInv() |
| 11 | isFull = true | |
| 12 | ||
| 13 | for i=1,15 do | |
| 14 | if turtle.getItemCount(i) == 0 then | |
| 15 | isFull = false | |
| 16 | end | |
| 17 | end | |
| 18 | ||
| 19 | if isFull == true then | |
| 20 | shell.run("emptyI")
| |
| 21 | end | |
| 22 | end | |
| 23 | - | local fuel = turtle.getFuelLevel() |
| 23 | + | |
| 24 | - | local roomSize = x * y * z |
| 24 | + | local y = tonumber(args[1]) |
| 25 | - | while fuel < roomSize do |
| 25 | + | local x = tonumber(args[2]) - 1 |
| 26 | - | if not turtle.refuel(1) then |
| 26 | + | |
| 27 | - | print("Not enough fuel, needs " .. roomSize .. " fuel do dig, add " .. (roomSize-fuel) .. " more to dig this size")
|
| 27 | + | |
| 28 | - | return |
| 28 | + | |
| 29 | print("Invalid dimensions")
| |
| 30 | return | |
| 31 | end | |
| 32 | ||
| 33 | if x < 0 or y < 0 or z < 0 then | |
| 34 | print("Invalid (negative) dimensions")
| |
| 35 | return | |
| 36 | end | |
| 37 | ||
| 38 | local direction = true | |
| 39 | for i = 1, z do | |
| 40 | for j = 1, y do | |
| 41 | for k = 1, x do | |
| 42 | ||
| 43 | ||
| 44 | turtle.dig() | |
| 45 | while not turtle.forward() do turtle.dig() end | |
| 46 | checkInv() | |
| 47 | ||
| 48 | ||
| 49 | end | |
| 50 | if j < y then | |
| 51 | if direction then | |
| 52 | turtle.turnRight() | |
| 53 | turtle.dig() | |
| 54 | while not turtle.forward() do turtle.dig() end | |
| 55 | turtle.turnRight() | |
| 56 | direction = false | |
| 57 | else | |
| 58 | turtle.turnLeft() | |
| 59 | turtle.dig() | |
| 60 | while not turtle.forward() do turtle.dig() end | |
| 61 | turtle.turnLeft() | |
| 62 | direction = true | |
| 63 | end | |
| 64 | end | |
| 65 | end | |
| 66 | if i < z then | |
| 67 | turtle.digDown() | |
| 68 | while not turtle.down() do turtle.digDown() end | |
| 69 | turtle.turnRight() | |
| 70 | turtle.turnRight() | |
| 71 | end | |
| 72 | end |