local function z()return Player and Player.Character end local function j()local z=findPlayerHumanoid(Player)return z and z.Torso end local function I(z)return z and(z.Parent and z.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")~=nil)end local function Z()local Z=z()if Z==nil then return end local O=findPlayerHumanoid(Player)if O==nil then return end local U=1.5 local Y=7.0 local n=j()if n==nil then return end local H=n.CFrame local K=H.lookVector local q=H.p local b=Ray.new(q+Vector3_new(0,-n.Size.Y/2,0),K*U)local w=Ray.new(q+Vector3_new(0,Y-n.Size.Y,0),K*U)local p,l=RayCastIgnoreList(workspace,b,{Z},false)local a,t=RayCastIgnoreList(workspace,w,{Z},false)if p and(a==nil and p.CanCollide==true)then if not I(p)then O.Jump=true end end end local O={[Enum.HumanoidStateType.FallingDown]=false;[Enum.HumanoidStateType.Flying]=false;[Enum.HumanoidStateType.Freefall]=false;[Enum.HumanoidStateType.GettingUp]=false,[Enum.HumanoidStateType.Ragdoll]=false;[Enum.HumanoidStateType.Running]=false;[Enum.HumanoidStateType.Seated]=false,[Enum.HumanoidStateType.Swimming]=false;[Enum.HumanoidStateType.Climbing]=false}local function U()local z=findPlayerHumanoid(Player)local j=z and z:GetState()if j then return O[j]==nil end return false end local function Y()return true end local function n(z)return z.magnitude<.05 end
--------------------------PC AUTO JUMPER-------------------------------

local function GetCharacter()
	return Player and Player.Character
end

local function GetTorso()
	local humanoid = findPlayerHumanoid(Player)
	return humanoid and humanoid.Torso
end

local function IsPartAHumanoid(part)
	return part and part.Parent and (part.Parent:FindFirstChild("Humanoid") ~= nil)
end

local function doAutoJump()
	local character = GetCharacter()
	if character == nil then
		return
	end

	local humanoid = findPlayerHumanoid(Player)
	if humanoid == nil then
		return
	end

	local rayLength = 1.5
	-- This is how high a ROBLOXian jumps from the mid point of his torso
	local jumpHeight = 7.0

	local torso = GetTorso()
	if torso == nil then
		return
	end

	local torsoCFrame = torso.CFrame
	local torsoLookVector = torsoCFrame.lookVector
	local torsoPos = torsoCFrame.p

	local torsoRay = Ray.new(torsoPos + Vector3_new(0, -torso.Size.Y / 2, 0), torsoLookVector * rayLength)
	local jumpRay = Ray.new(torsoPos + Vector3_new(0, jumpHeight - torso.Size.Y, 0), torsoLookVector * rayLength)

	local hitPart, _ = RayCastIgnoreList(workspace, torsoRay, { character }, false)
	local jumpHitPart, _ = RayCastIgnoreList(workspace, jumpRay, { character }, false)

	if hitPart and jumpHitPart == nil and hitPart.CanCollide == true then
		-- NOTE: this follow line is not in the C++ impl, but an improvement  in Click to Move
		if not IsPartAHumanoid(hitPart) then
			humanoid.Jump = true
		end
	end
end

local NO_JUMP_STATES = {
	[Enum.HumanoidStateType.FallingDown] = false,
	[Enum.HumanoidStateType.Flying] = false,
	[Enum.HumanoidStateType.Freefall] = false,
	[Enum.HumanoidStateType.GettingUp] = false,
	[Enum.HumanoidStateType.Ragdoll] = false,
	[Enum.HumanoidStateType.Running] = false,
	[Enum.HumanoidStateType.Seated] = false,
	[Enum.HumanoidStateType.Swimming] = false,

	-- Special case to detect if we are on a ladder
	[Enum.HumanoidStateType.Climbing] = false,
}

local function enableAutoJump()
	local humanoid = findPlayerHumanoid(Player)
	local currentState = humanoid and humanoid:GetState()
	if currentState then
		return NO_JUMP_STATES[currentState] == nil
	end
	return false
end

local function getAutoJump()
	return true
end

local function vec3IsZero(vec3)
	return vec3.magnitude < 0.05
end
