SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --file:buildsorter |
| 1 | + | --file:ladder |
| 2 | - | --pastebin:hkMa7atX |
| 2 | + | --pastebin:wc6RNHeV |
| 3 | ||
| 4 | targs = {...}
| |
| 5 | os.loadAPI("movement")
| |
| 6 | ||
| 7 | local m = movement | |
| 8 | - | local barrelSlot = 1 |
| 8 | + | local ladderSlot = 1 |
| 9 | - | local chestSlot = 2 |
| 9 | + | local wallSlot = 2 |
| 10 | - | local turtleSlot = 3 |
| 10 | + | m.reservedslots = 2 |
| 11 | ||
| 12 | - | m.reservedslots = 3 |
| 12 | + | |
| 13 | if ( #targs ~= 2 ) then | |
| 14 | - | m.turtleForwardX(2) |
| 14 | + | print("Usage : ladder <up|down> <count>")
|
| 15 | - | m.turtleUpX(4) |
| 15 | + | print("Slot 1 : Ladders.")
|
| 16 | - | m.turtleForwardX(1) |
| 16 | + | print("Slot 2 : Walls")
|
| 17 | - | turtle.back() |
| 17 | + | return |
| 18 | end | |
| 19 | - | for i = 1, 3 do |
| 19 | + | |
| 20 | - | m.selectMaterial(chestSlot) |
| 20 | + | local direction = targs[1] |
| 21 | local count = tonumber(targs[2]) | |
| 22 | - | m.turtleDown() |
| 22 | + | |
| 23 | - | m.selectMaterial(turtleSlot) |
| 23 | + | if (turtle.getItemCount(ladderSlot)< count) then |
| 24 | print("not enough ladders in slot 1.")
| |
| 25 | - | m.turtleDown() |
| 25 | + | return |
| 26 | end | |
| 27 | ||
| 28 | - | m.selectMaterial(chestSlot) |
| 28 | + | if (turtle.getItemCount(wallSlot)< count) then |
| 29 | - | turtle.place() |
| 29 | + | print("not enough walls in slot 2.")
|
| 30 | return | |
| 31 | - | for i = 1, 15 do |
| 31 | + | |
| 32 | - | turtle.turnLeft() |
| 32 | + | |
| 33 | ||
| 34 | - | turtle.turnRight() |
| 34 | + | for i=1,count do |
| 35 | - | for j = 1, 2 do |
| 35 | + | |
| 36 | - | m.selectMaterial(barrelSlot) |
| 36 | + | m.paintForward(wallSlot) |
| 37 | - | turtle.place() |
| 37 | + | turtle.back() |
| 38 | - | m.turtleUpX(2) |
| 38 | + | m.selectMaterial(ladderSlot) |
| 39 | turtle.place() | |
| 40 | - | m.selectMaterial(barrelSlot) |
| 40 | + | if direction == "up" then |
| 41 | m.turtleUp() | |
| 42 | - | m.turtleDownX(4) |
| 42 | + | else |
| 43 | m.turtleDown() | |
| 44 | end | |
| 45 | end | |
| 46 | ||
| 47 | -- return | |
| 48 | for i=1,count do | |
| 49 | if direction == "up" then | |
| 50 | m.turtleDown() | |
| 51 | else | |
| 52 | m.turtleUp() | |
| 53 | end | |
| 54 | end |