Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Turtle Adventurer
- -- By CaptainSpaceCat
- -- This program will send a turtle off into the wilderness to travel in a straight line as far as possible
- -- You must equip the turtle with 3 chunk loaders so that it can load the chunk it's in and the next one
- -- You should also give it an rftools Matter Receiver so that you can teleport to it once it gets thousands of blocks away!
- -- NOTE: you MUST start the turtle ONE BLOCK AWAY from the edge of a chunk, facing INTO the chunk
- -- otherwise the chunk loaders won't work properly
- local anchorSlot = 1
- local receiverSlot = 2
- local tArgs = {...}
- local function forward(num)
- num = num or 1
- for i = 1, num do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- end
- end
- local function up(num)
- num = num or 1
- for i = 1, num do
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- end
- end
- local function down(num)
- num = num or 1
- for i = 1, num do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- end
- end
- local function left(num)
- num = num or 1
- for i = 1, num do
- turtle.turnLeft()
- end
- end
- local function right(num)
- num = num or 1
- for i = 1, num do
- turtle.turnRight()
- end
- end
- local function placeAnchor()
- turtle.dig()
- turtle.select(anchorSlot)
- turtle.place()
- end
- local function placeAnchorUp()
- turtle.digUp()
- turtle.select(anchorSlot)
- turtle.placeUp()
- end
- local function pickupAnchor()
- turtle.select(anchorSlot)
- turtle.dig()
- end
- local function loop(chunks)
- for i = 1, chunks do
- forward(14)
- placeAnchor()
- placeAnchorUp()
- left(2)
- forward(14)
- pickupAnchor()
- left(2)
- forward(14)
- right()
- forward()
- left()
- forward()
- up()
- left()
- forward()
- left()
- pickupAnchor()
- left(2)
- forward()
- down()
- end
- end
- local function placeReceiver()
- turtle.select(receiverSlot)
- turtle.dig()
- turtle.place()
- end
- local chunks = turtle.getFuelLevel() / 47
- print("Adventuring approximately " .. tostring(tArgs[1] or chunks) .. " chunks!")
- loop(tArgs[1] or chunks)
- placeReceiver()
Add Comment
Please, Sign In to add comment