SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local l,w,h = ... -- 50, 40, 5 |
| 1 | + | local l,w,h = ... |
| 2 | - | local function build_col(h) |
| 2 | + | local function slot_plus() turtle.select(turtle.getSelectedSlot()%16+1) end |
| 3 | - | for ih=1,h do |
| 3 | + | local function build_line(n) |
| 4 | for i=1,n do | |
| 5 | - | turtle.placeDown() |
| 5 | + | if not turtle.placeDown() then |
| 6 | - | if turtle.getItemCount()==0 then |
| 6 | + | slot_plus() |
| 7 | - | turtle.select(turtle.getSelectedSlot()+1) |
| 7 | + | turtle.placeDown() |
| 8 | - | end |
| 8 | + | end |
| 9 | while not turtle.getItemCount() do slot_plus() end | |
| 10 | - | turtle.forward() |
| 10 | + | turtle.forward() |
| 11 | - | while turtle.down() do end |
| 11 | + | |
| 12 | end | |
| 13 | - | local function build_wall(n,h) |
| 13 | + | local function build_layer(l,w) |
| 14 | build_line(l-1) | |
| 15 | - | build_col(h) |
| 15 | + | turtle.turnLeft() |
| 16 | build_line(w-1) | |
| 17 | turtle.turnLeft() | |
| 18 | - | --[[ |
| 18 | + | build_line(l-1) |
| 19 | - | build_wall(l-1) |
| 19 | + | turtle.turnLeft() |
| 20 | - | turtle.turnLeft() |
| 20 | + | build_line(w-1) |
| 21 | - | turtle.back() |
| 21 | + | turtle.turnLeft() |
| 22 | - | build_wall(w-1) |
| 22 | + | |
| 23 | - | turtle.turnLeft() |
| 23 | + | local function build_wall(l,w,h) |
| 24 | - | turtle.back() |
| 24 | + | for i=1,h do |
| 25 | - | build_wall(l-1) |
| 25 | + | |
| 26 | - | turtle.turnLeft() |
| 26 | + | build_layer(l,w) |
| 27 | - | turtle.back() |
| 27 | + | |
| 28 | - | build_wall(w)]] |
| 28 | + | |
| 29 | - | return {build_wall=build_wall}
|
| 29 | + | |
| 30 | if not l then | |
| 31 | error("Must have three arguments: length, width and height.")
| |
| 32 | end | |
| 33 | if tonumber(l) and tonumber(w) and tonumber(h) then | |
| 34 | build_wall(l,w,h) | |
| 35 | end | |
| 36 | return {build=build_wall}
| |
| 37 |