SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | 2013 (c) psychedelixx | |
| 3 | - | Minecraft Turtle: Stairs |
| 3 | + | Minecraft Turtle: Stairs (Robust) |
| 4 | 2013-05-21 | |
| 5 | ||
| 6 | Digs a simple stair and places missing ground blocks and torches (every 4th horizontal block). | |
| 7 | ||
| 8 | Usage: | |
| 9 | - use turtle and type "label set <name>" | |
| 10 | (to give your turtle an unique name so it remembers its programs) | |
| 11 | - | - type "pastebin get R9NXSxDx stairs" |
| 11 | + | - type "pastebin get hT1hG700 stairs" |
| 12 | - place solid blocks in slot 16 (lower right corner) | |
| 13 | - place torches in slot 15 (left of slot 16) | |
| 14 | - type "stairs <height> [<limit>]" | |
| 15 | • where <height> represents the height of the hallway (3-5 seems good) | |
| 16 | • and <limit> (optional) represents the Y coordinates digged down | |
| 17 | (if you're at y64 and type in 10, it will dig until it's at y54) | |
| 18 | --]] | |
| 19 | ||
| 20 | local args = { ... }
| |
| 21 | if #args < 1 then | |
| 22 | print( "Usage: stairs <height> [<limit>]" ) | |
| 23 | error() | |
| 24 | end | |
| 25 | height = tonumber(args[1]) | |
| 26 | limit = 256 | |
| 27 | if #args == 2 then | |
| 28 | limit = tonumber(args[2]) | |
| 29 | end | |
| 30 | ||
| 31 | if height < 2 then | |
| 32 | print( "The height must be >= 2." ) | |
| 33 | error() | |
| 34 | end | |
| 35 | print("======== 2013 (c) psychedelixx ========")
| |
| 36 | print("Let's go!")
| |
| 37 | ||
| 38 | while limit > 0 do | |
| 39 | ||
| 40 | if turtle.getFuelLevel() < height*2 then | |
| 41 | turtle.refuel() | |
| 42 | end | |
| 43 | if turtle.getFuelLevel() < height*2 then | |
| 44 | print("Fuel is almost empty!")
| |
| 45 | end | |
| 46 | ||
| 47 | print("")
| |
| 48 | print("Remaining: " .. limit)
| |
| 49 | print("Next torch in: " .. limit%4 .. "m")
| |
| 50 | ||
| 51 | for var = 0, height-3 do | |
| 52 | - | turtle.digUp() |
| 52 | + | t.digUp() |
| 53 | if var < height-3 then | |
| 54 | - | turtle.up() |
| 54 | + | t.up() |
| 55 | end | |
| 56 | if var == 0 and limit%4 == 0 then | |
| 57 | - | turtle.turnRight() |
| 57 | + | t.right() |
| 58 | - | turtle.dig() |
| 58 | + | t.dig() |
| 59 | turtle.select(15) | |
| 60 | turtle.place() | |
| 61 | - | turtle.turnLeft() |
| 61 | + | t.left() |
| 62 | end | |
| 63 | end | |
| 64 | for var = 0, height-4 do turtle.down() end | |
| 65 | - | turtle.digDown() |
| 65 | + | t.digDown() |
| 66 | - | turtle.down() |
| 66 | + | t.down() |
| 67 | if not turtle.detectDown() then | |
| 68 | turtle.select(16) | |
| 69 | turtle.placeDown() | |
| 70 | end | |
| 71 | ||
| 72 | - | while not turtle.forward() do |
| 72 | + | t.dig() |
| 73 | - | turtle.dig() |
| 73 | + | |
| 74 | turtle.forward() | |
| 75 | limit = limit-1 | |
| 76 | end |