freeslot("S_PLAY_COMPLETE_SWIFT", "S_PLAY_COMPLETEEND_SWIFT", "SPR2_VICT")

states[S_PLAY_COMPLETE_SWIFT] = {
    sprite = SPR_PLAY,
    frame = FF_ANIMATE|SPR2_VICT,
    tics = 10,
    var1 = 3,
    var2 = 4,
    nextstate = S_PLAY_COMPLETEEND_SWIFT
}

states[S_PLAY_COMPLETEEND_SWIFT] = {
    sprite = SPR_PLAY,
    frame = SPR2_VICT|A,
    tics = -1,
    nextstate = S_PLAY_COMPLETEEND_SWIFT
}

addHook("PlayerThink", function(player) -- Misc Player Stuff
    if player and player.mo and player.mo.valid and player.mo.skin == "swift"
    and not player.bot
        if ((player.exiting <= 3*TICRATE and player.exiting != 0) and player.mo.state != S_PLAY_COMPLETE_SWIFT and player.mo.state != S_PLAY_COMPLETEEND_SWIFT)
        and not (multiplayer)
            if P_IsObjectOnGround(player.mo)
                player.mo.state = S_PLAY_COMPLETE_SWIFT -- Strike a Pose!
            end
        end
        
        if (player.mo.state == S_PLAY_COMPLETE_SWIFT or player.mo.state == S_PLAY_COMPLETEEND_SWIFT) and P_IsObjectOnGround(player.mo)
			if (player.speed > 5*player.mo.scale)
				player.mo.friction = $ + FRACUNIT/35
			else
				player.mo.friction = $ + FRACUNIT/999
			end
			
			player.pflags = $|PF_STASIS
			
			if (player.speed > 5*player.mo.scale)
				P_SpawnSkidDust(player, player.mo.radius, true)
				player.powers[pw_noautobrake] = 2
			end
        end
    end
end)