local modemSide = "left"
local fuelSlot = 16

rednet.open(modemSide)
print("Chunky follower online")

local function refuel()
    if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 200 then
        turtle.select(fuelSlot)
        turtle.refuel(1)
    end
end

while true do
    local id, msg = rednet.receive()

    if msg == "move" then
        refuel()

        while turtle.detect() do
            sleep(0.2)
        end

        if turtle.forward() then
            rednet.send(id, "moved")
        else
            rednet.send(id, "stuck")
        end
    end
end
