public void OnPilotDie(ref MyEventPilotDie msg)
        {
            MyPlayerRemote sender = (MyPlayerRemote)msg.SenderConnection.Tag;

            MyEntity deadPilotEntity;
            if (MyEntities.TryGetEntityById(msg.EntityId.ToEntityId(), out deadPilotEntity) && deadPilotEntity is MySmallShip)
            {
                Log("On pilot died: " + deadPilotEntity.DisplayName);

                var ship = (MySmallShip)deadPilotEntity;

                if (!ship.IsPilotDead())
                {
                    ship.DisplayName += " (dead)";
                }

                ship.PilotHealth = 0;

                ship.InventoryChanged += new Action<MyShip>(s => Inventory_OnInventoryContentChange(s.Inventory, s));

                if (sender.Ship == deadPilotEntity)
                {
                    OnPeerDied(sender, msg.KillerId);
                }
            }
            else
            {
                Alert("Dead pilot entity not found", msg.SenderEndpoint, msg.EventType);
            }
        }
        public void PilotDie(MySmallShip deadPilotEntity, MyEntity killer)
        {
            Debug.Assert(deadPilotEntity.EntityId.HasValue);

            Log("Pilot died: " + deadPilotEntity.DisplayName);

            MyEventPilotDie msg = new MyEventPilotDie();
            msg.EntityId = deadPilotEntity.EntityId.Value.NumericValue;
            msg.KillerId = killer != null && killer.EntityId != null ? killer.EntityId.Value.PlayerId : (byte?)null;
            m_respawnTime = MyMinerGame.TotalGamePlayTimeInMilliseconds + (int)m_multiplayerConfig.RespawnTime.TotalMilliseconds;
            Peers.SendToAll(ref msg, NetDeliveryMethod.ReliableOrdered);

            if (deadPilotEntity == MySession.PlayerShip)
            {
                MyHudWarnings.Remove(deadPilotEntity);
                OnMeDied(msg.KillerId);
            }

            if (!deadPilotEntity.IsPilotDead())
            {
                deadPilotEntity.DisplayName = MyClientServer.LoggedPlayer.GetDisplayName() + " (dead)";
            }
            
            deadPilotEntity.PilotHealth = 0;

            // Send inventory on die to allow looting
            if (deadPilotEntity is IMyInventory)
            {
                Inventory_OnInventoryContentChange(((IMyInventory)deadPilotEntity).Inventory, deadPilotEntity);
            }

            deadPilotEntity.InventoryChanged += new Action<MyShip>(s => Inventory_OnInventoryContentChange(s.Inventory, s));
        }