local k=Vector3_new(1,1,1)local function q()return k end local function P(k)if getAutoJump()and enableAutoJump()then local k=q()if not vec3IsZero(k)then doAutoJump()end end end local function L()local k={}local q=false local L=nil function k.Run(P)q=true local b=nil b=coroutine.create(function()while q and b==L do k:Step()task.wait()end end)L=b coroutine.resume(b)end function k.Stop(k)q=false end function k.Step(k)P()end return k end
-- NOTE: This function is radically different from the engine's implementation
local walkVelocityVector = Vector3_new(1, 1, 1)
local function calcDesiredWalkVelocity()
	-- TEMP
	return walkVelocityVector
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()
				task.wait()
			end
		end)
		runRoutine = thisRoutine
		coroutine.resume(thisRoutine)
	end

	function this:Stop()
		running = false
	end

	function this:Step()
		preStepSimulatorSide()
	end

	return this
end
