Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- --Movement and Placement of Fence
- function place(size)
- local num = size
- repeat
- turtle.place(1)
- turnAround()
- look()
- turnAround()
- turtle.back()
- sleep(1)
- num = num - 1
- until num == 0
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function look()
- if turtle.detect() then
- turtle.dig()
- end
- end
- function lastPlace()
- turtle.place(1)
- turtle.turnLeft()
- look()
- turnAround()
- turtle.back()
- end
- function lastFence()
- turtle.turnRight()
- sleep(1)
- look()
- sleep(1)
- turnAround()
- turtle.back()
- turtle.place(1)
- end
- --Main Program
- local n = tonumber(tArgs[1])
- for i=1,3,1 do
- turtle.select(i)
- place(n-1)
- sleep(1)
- lastPlace()
- sleep(1)
- end
- turtle.select(4)
- place(n-2)
- lastFence()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement