SHOW:
|
|
- or go back to the newest paste.
| 1 | --[[ | |
| 2 | - | 2013 (c) psychedelixx |
| 2 | + | 2014 (c) psychedelixx |
| 3 | - | Minecraft Turtle: Pyramid |
| 3 | + | Minecraft Turtle: Walls |
| 4 | - | 2013-06-14 |
| 4 | + | 2014-03-,0 |
| 5 | ||
| 6 | - | desc |
| 6 | + | Builds a wall e.g. for a house |
| 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 <code> pyramid" |
| 11 | + | - type "pastebin get RVrtjU1f walls" |
| 12 | - | - type "pyramid <length>" (32 for full 4x4x64 chest) |
| 12 | + | - type "walls <width> <length> <height>" |
| 13 | --]] | |
| 14 | ||
| 15 | slot = 0 | |
| 16 | ||
| 17 | function move() | |
| 18 | - | if turtle.getFuelLevel() < 5 then |
| 18 | + | |
| 19 | - | turtle.refuel() |
| 19 | + | |
| 20 | turtle.select(slot%16+1) | |
| 21 | end | |
| 22 | turtle.placeDown() | |
| 23 | turtle.dig() | |
| 24 | turtle.forward() | |
| 25 | end | |
| 26 | ||
| 27 | local args = { ... }
| |
| 28 | if #args < 3 then | |
| 29 | print( "Usage: walls <width> <length> <height>" ) | |
| 30 | - | if #args < 1 then |
| 30 | + | |
| 31 | - | print( "Usage: pyramid <length> [32 for full 4x4x64 chest]" ) |
| 31 | + | |
| 32 | width = tonumber(args[1]) | |
| 33 | length = tonumber(args[2]) | |
| 34 | - | x = tonumber(args[1]) |
| 34 | + | height = tonumber(args[3]) |
| 35 | - | odd = x%2==1 |
| 35 | + | |
| 36 | if turtle.getFuelLevel() < (2*width + 2*length) * height then | |
| 37 | - | if turtle.getFuelLevel() == 0 then |
| 37 | + | print("I need " .. (2*width + 2*length) * height - turtle.getFuelLevel() .. " fuel.")
|
| 38 | - | turtle.refuel() |
| 38 | + | |
| 39 | print("======== 2014 (c) psychedelixx ========")
| |
| 40 | print("Let's go!")
| |
| 41 | - | if turtle.getFuelLevel() == 0 then |
| 41 | + | |
| 42 | - | print("I need fuel!")
|
| 42 | + | |
| 43 | repeat | |
| 44 | - | print("======== 2013 (c) psychedelixx ========")
|
| 44 | + | l = 1 |
| 45 | while l < length do | |
| 46 | - | |
| 46 | + | |
| 47 | - | start = true |
| 47 | + | l = l + 1 |
| 48 | - | dir = 1 |
| 48 | + | end |
| 49 | turtle.turnRight() | |
| 50 | ||
| 51 | - | if dir%4 == 1 and not start then |
| 51 | + | w = 1 |
| 52 | while w < width do | |
| 53 | - | turtle.up() |
| 53 | + | |
| 54 | - | end |
| 54 | + | w = w + 1 |
| 55 | - | block = 1 |
| 55 | + | end |
| 56 | - | if odd and x==1 then |
| 56 | + | |
| 57 | ||
| 58 | - | x=x-1 |
| 58 | + | l = 1 |
| 59 | - | else repeat |
| 59 | + | while l < length do |
| 60 | move() | |
| 61 | - | block = block+1 |
| 61 | + | l = l + 1 |
| 62 | - | until block >= x end |
| 62 | + | end |
| 63 | turtle.turnRight() | |
| 64 | - | dir = dir+1 |
| 64 | + | |
| 65 | - | if dir%4 == 1 or dir%4 == 0 then x = x-1 end |
| 65 | + | w = 1 |
| 66 | - | if start then start = false end |
| 66 | + | while w < width do |
| 67 | - | until x<=0 |
| 67 | + | |
| 68 | w = w + 1 | |
| 69 | end | |
| 70 | turtle.up() | |
| 71 | turtle.turnRight() | |
| 72 | ||
| 73 | height = height - 1 | |
| 74 | until height<=0 | |
| 75 | end |