SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --[[ |
| 1 | + | slot = 1 |
| 2 | - | 2014 (c) psychedelixx |
| 2 | + | |
| 3 | - | Minecraft Turtle: Room (Tobust) |
| 3 | + | function getSlot() |
| 4 | - | 2014-04-21 |
| 4 | + | while turtle.getItemCount(slot) == 0 and slot < 16 do |
| 5 | slot = slot + 1 | |
| 6 | - | Digs a room with specified dimensions. |
| 6 | + | |
| 7 | - | |
| 7 | + | if turtle.getItemCount(slot) == 0 and slot == 16 then |
| 8 | - | Robust API: |
| 8 | + | print("No more ressources... Fill me up and press enter")
|
| 9 | - | http://computercraft.info/wiki/Robust_Turtle_API |
| 9 | + | read() |
| 10 | slot = 1 | |
| 11 | - | Usage: |
| 11 | + | |
| 12 | - | - use turtle and type "label set <name>" |
| 12 | + | |
| 13 | - | (to give your turtle an unique name so it remembers its programs) |
| 13 | + | |
| 14 | - | - type "pastebin get VRR7iLat room" |
| 14 | + | |
| 15 | - | - type "room <width> [<length>] [<height>]" |
| 15 | + | |
| 16 | - | - default length = width |
| 16 | + | |
| 17 | - | - default height = 2 |
| 17 | + | print("Usage: bridge <length> <buildSides 0|1>")
|
| 18 | - | - place solid blocks in slot 16 to fill the ground |
| 18 | + | |
| 19 | - | --]] |
| 19 | + | |
| 20 | error() | |
| 21 | - | function move() |
| 21 | + | |
| 22 | - | t.digUp() |
| 22 | + | |
| 23 | - | t.dig() |
| 23 | + | |
| 24 | - | t.forward() |
| 24 | + | length = tonumber(args[1]) |
| 25 | - | |
| 25 | + | sides = 0 |
| 26 | - | empty = 0 |
| 26 | + | |
| 27 | - | if nextTurnRight then |
| 27 | + | |
| 28 | - | print("w"..w.." l"..l.." h"..h.." next turn right. Fuel: " .. turtle.getFuelLevel())
|
| 28 | + | |
| 29 | - | else |
| 29 | + | length = tonumber(args[1]) |
| 30 | - | print("w"..w.." l"..l.." h"..h.." next turn left. Fuel: " .. turtle.getFuelLevel())
|
| 30 | + | sides = tonumber(args[2]) |
| 31 | end | |
| 32 | - | |
| 32 | + | |
| 33 | - | for slot = 1, 16 do |
| 33 | + | if turtle.getFuelLevel() < length then |
| 34 | - | if turtle.getItemCount(slot) == 0 then |
| 34 | + | print("I need " .. length - turtle.getFuelLevel() .. " more fuel!")
|
| 35 | - | empty = 1 |
| 35 | + | |
| 36 | - | break |
| 36 | + | print("======== 2019 (c) psychedelixx ========")
|
| 37 | print("Let's go!")
| |
| 38 | ||
| 39 | - | if empty == 0 then |
| 39 | + | while length > 0 do |
| 40 | - | t.down(h-1) |
| 40 | + | print("Remaining: " .. length)
|
| 41 | - | |
| 41 | + | |
| 42 | - | if (h-1)%4==0 then |
| 42 | + | t.dig() |
| 43 | - | if nextTurnRight then |
| 43 | + | t.forward() |
| 44 | - | t.left() |
| 44 | + | |
| 45 | - | t.forward(w-1) |
| 45 | + | t.placeDown(slot) |
| 46 | - | t.left() |
| 46 | + | getSlot() |
| 47 | - | t.forward(l) |
| 47 | + | |
| 48 | - | else |
| 48 | + | if sides == 1 then |
| 49 | - | t.right() |
| 49 | + | t.placeLeft(slot) |
| 50 | - | t.forward(w-1) |
| 50 | + | getSlot() |
| 51 | - | t.left() |
| 51 | + | t.placeRight(slot) |
| 52 | - | t.forward(length-l-1) |
| 52 | + | getSlot() |
| 53 | end | |
| 54 | - | else |
| 54 | + | |
| 55 | - | if nextTurnRight then |
| 55 | + | length = length - 1 |
| 56 | - | t.right() |
| 56 | + | |
| 57 | - | t.forward(width-w) |
| 57 | + | |
| 58 | - | t.left() |
| 58 | + | t.place(slot) |
| 59 | - | t.forward(length-l-1) |
| 59 | + |