public void PlayerPlayDeathAnimation(coPlayer player)
            {
            int numDeathAnimations = player.getNumDeathAnimations();
            if (numDeathAnimations <= 0)
                return;

            coGameConnection client = player["client"];
            if (client.isObject())
                {
                int deathidx = client["deathIdx"].AsInt();
                if ((deathidx > numDeathAnimations) || (deathidx == 0))
                    {
                    deathidx = 1;
                    }
                player.setActionThread("Death" + deathidx, false, true);
                deathidx++;
                client["deathIdx"] = deathidx.AsString();
                }
            else
                {
                int r = new Random().Next(1, numDeathAnimations);
                player.setActionThread("Death" + r, false, true);
                }
            }