local function J()return Vector3.new(1,1,1)end local function O(O)if getAutoJump()and enableAutoJump()then local O=J()if not vec3IsZero(O)then doAutoJump()end end end local function b()local J={}local b=false local D=nil function J.Run(O)b=true local m=nil m=coroutine.create(function()while b and m==D do J:Step()wait()end end)D=m coroutine.resume(m)end function J.Stop(J)b=false end function J.Step(J)O()end return J end

local function calcDesiredWalkVelocity()
	-- TEMP
	return Vector3.new(1,1,1)
end

local function preStepSimulatorSide(dt)
	if getAutoJump() and enableAutoJump() then
		local desiredWalkVelocity = calcDesiredWalkVelocity();
		if (not vec3IsZero(desiredWalkVelocity)) then
			doAutoJump();
		end
	end
end

local function AutoJumper()
	local this = {}
	local running = false
	local runRoutine = nil

	function this:Run()
		running = true
		local thisRoutine = nil
		thisRoutine = coroutine.create(function()
			while running and thisRoutine == runRoutine do
				this:Step()
				wait()
			end
		end)
		runRoutine = thisRoutine
		coroutine.resume(thisRoutine)
	end

	function this:Stop()
		running = false
	end

	function this:Step()
		preStepSimulatorSide()
	end

	return this
end
