local function l()return Vector3.new(1,1,1)end local function w(w)if getAutoJump()and enableAutoJump()then local w=l()if not vec3IsZero(w)then doAutoJump()end end end local function U()local l={}local U=false local Z=nil function l.Run(w)U=true local A=nil A=coroutine.create(function()while U and A==Z do l:Step()wait()end end)Z=A coroutine.resume(A)end function l.Stop(l)U=false end function l.Step(l)w()end return l end
-- NOTE: This function is radically different from the engine's implementation
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
