Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- arg = {...}
- followRange = 3
- heightFollowRange = 2
- player = bladze420
- sensor = peripheral.wrap("left")
- function orient(pos)
- while facing ~= pos do
- turtle.turnRight()
- if facing == 3 then
- facing = 0
- else
- facing = facing + 1
- end
- end
- if not turtle.forward() then
- turtle.attack()
- --turtle.dig()
- end
- end
- function checkBlocks(dir)
- blocks = sensor.sonicScan()
- end
- --if arg[1] == int then
- facing = arg[1] --0 is south, 1 is west, 2 is north, 3 is east
- while true do
- if turtle.getFuelLevel() <= 50 then
- print("Fuel low, please refuel")
- print("Fuel level: "..turtle.getFuelLevel())
- end
- data = sensor.getPlayerData(player)
- if data.position.x <= -followRange then
- orient(1)
- --checkBlocks("-x")
- end
- if data.position.x >= followRange then
- orient(3)
- --checkBlocks("x")
- end
- if data.position.y <= -heightFollowRange then
- if not turtle.down() then
- --turtle.digDown()
- turtle.attackDown()
- end
- --checkBlocks("-y")
- end
- if data.position.y >= heightFollowRange then
- if not turtle.up() then
- --turtle.digUp()
- turtle.attackUp()
- end
- --checkBlocks("y")
- end
- if data.position.z <= -followRange then
- orient(2)
- --checkBlocks("-z")
- end
- if data.position.z >= followRange then
- orient(0)
- --checkBlocks("z")
- end
- end
- --else
- --print("Usage: follow <orientation>")
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement