Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- version = "pop: Rev 0.1"
- mission= "Protect Our Portal"
- instructions = "Place stack(s) of material starting in first slot."
- args = {...}
- nArgs = #args
- usage = "pop"
- materialSlot = 1
- length = 8
- width = 6
- function place()
- ensureMaterial()
- turtle.place()
- end
- function placeUp()
- ensureMaterial()
- turtle.placeUp()
- end
- function placeDown()
- ensureMaterial()
- turtle.placeDown()
- end
- function ensureMaterial()
- if turtle.getItemCount(materialSlot) < 3 then
- organizeMaterial()
- end
- if turtle.getItemCount(materialSlot) < 3 then
- print("No more material")
- return false
- end
- return true
- end
- function organizeMaterial()
- local i
- materialCount = turtle.getItemCount(materialSlot)
- if materialCount < 6 then
- -- print("Attempting to refill slot ", materialSlot)
- for i=2,12 do
- turtle.select(i)
- if turtle.compareTo(materialSlot) then
- turtle.transferTo(materialSlot)
- end
- end
- end
- turtle.select(materialSlot)
- end
- function buildWall(length)
- for i=1,length do
- ensureMaterial()
- turtle.select(materialSlot)
- placeUp()
- placeDown()
- if i == length then
- turtle.turnLeft()
- end
- turtle.back()
- place()
- end
- end
- turtle.forward()
- turtle.turnRight()
- turtle.up()
- buildWall(length)
- buildWall(width-1)
- buildWall(length-1)
- turtle.down()
- turtle.turnLeft()
- turtle.turnLeft()
- shell.run("floor 4 7 4")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement