// Called when model is being sent to a player.
        static void OnSendingModel(Entity e, ref string modelName, Player dst)
        {
            if (e.Model.StartsWith("$"))
            {
                // don't run if $model
                return;
            }
            Debug("OnSendingModel {0}: {1}", dst.name, modelName);

            var storedModel = new StoredCustomModel(modelName);

            if (storedModel.Exists() && storedModel.UsesHumanParts())
            {
                // if this is a custom model and it uses human parts,
                // check if we need to skin transform

                var skinName = e.SkinName;

                if (MemoizedGetSkinType.GetCached(skinName, out SkinType skinType))
                {
                    var oldModelName = storedModel.GetFullNameWithScale();
                    storedModel.ApplySkinType(skinType);

                    var newModelName = storedModel.GetFullNameWithScale();
                    if (!oldModelName.CaselessEq(newModelName))
                    {
                        Debug("OVERRIDE MODEL {0} -> {1}", oldModelName, newModelName);
                        modelName = newModelName;
                        e.SetModel(newModelName);
                    }
                    else
                    {
                        Debug("already {0}", newModelName);
                    }
                }
                else
                {
                    // spawn long task
                    lock (GetSkinTypeTasks) {
                        GetSkinTypeTasks.AddOrUpdate(
                            e,
                            (e2) => {
                            return(SpawnGetSkinType(e2));
                        },
                            (e2, oldValue) => {
                            Debug("cancelling {0}", e2.SkinName);
                            oldValue.cancelSource.Cancel();
                            return(SpawnGetSkinType(e2));
                        }
                            );
                    }
                }
            }

            // make sure the model is already defined for player
            // before we send the ChangeModel packet
            //
            // also check if we should remove unused old model
            CheckAddRemove(dst, dst.level);

            // // check if we should use default skin
            // if (
            //     e == dst &&
            //     (
            //         // unset skin
            //         dst.SkinName == dst.truename ||
            //         // or some other unsaved skin
            //         !Server.skins.Contains(dst.name)
            //     ) &&
            //     storedModel.Exists()
            // ) {
            // }
        }