freeslot("S_PLAY_FFLL", "SPR2_FFLL")

states[S_PLAY_FFLL] = {SPR_PLAY, SPR2_FFLL|FF_ANIMATE, 3, nil, 0, 0, S_PLAY_FFLL}
addHook("ThinkFrame", function(player)
	for player in players.iterate do
	player.slowing = player.slowing or false
	player.slowspeed = player.slowspeed or 0
	player.isfloating = player.isfloating or false
	if (player.mo and player.mo.valid and player.mo.skin == "fakerguide") and player.slowing == true and not P_IsObjectOnGround(player.mo) == true and (player.cmd.buttons & BT_CUSTOM2) then
	P_SetObjectMomZ(player.mo, player.slowspeed)
	player.pflags = $ |PF_NOJUMPDAMAGE
	player.mo.state = S_PLAY_FFLL
	P_SpawnMobjFromMobj(player.mo, P_RandomRange(-18, 18) * FRACUNIT, P_RandomRange(-18, 18) * FRACUNIT, P_RandomRange(0, 32) * FRACUNIT, MT_ARIDDUST)
	player.isfloating = true
	else
	player.isfloating = false
	end
	if not player.powers[pw_super] then
	player.slowspeed = -1 * FRACUNIT
	else
	player.slowspeed = 0 * FRACUNIT
	end
	if (player.mo.state == S_PLAY_JUMP or player.mo.state == S_PLAY_FFLL or player.mo.state == S_PLAY_FALL) then
	player.slowing = true
	else
	player.slowing = false
	end
	if not player.isfloating and player.mo.state == S_PLAY_FFLL then
	player.mo.state = S_PLAY_FALL
	end
    if player.mo.state == S_PLAY_FFLL and not S_SoundPlaying(player.mo, sfx_fflt) then
	S_StartSound(player.mo, sfx_fflt)
	end
	if P_IsObjectOnGround(player.mo) then
	player.slowing = false
	player.isfloating = false
	if player.isfloating and player.speed >= player.normalspeed then
	P_InstaThrust(player.mo, player.mo.angle, FixedMul(28 * FRACUNIT, player.mo.scale))
	end
	if not player.mo.skin == "fakerguide" then 
	player.isfloating = false
	player.slowing = false
	end
	end
	end
end)