Fixed chat messages being assigned to the wrong sender when their bodies have been eaten

This commit is contained in:
juanjp600
2017-12-03 19:06:01 -03:00
parent a19579088f
commit e323e9dc71
4 changed files with 10 additions and 10 deletions
@@ -224,15 +224,12 @@ namespace Barotrauma.Networking
msg.Write((byte)Type);
msg.Write(Text);
msg.Write(SenderName);
msg.Write(Sender != null && c.InGame);
if (Sender != null && c.InGame)
{
msg.Write(Sender.ID);
}
else
{
msg.Write(SenderName);
}
}
}
@@ -108,6 +108,13 @@ namespace Barotrauma
{
if (GameMain.Client != null) return;
if (removeQueue.Contains(entity) || entity.Removed) return;
if (entity is Character)
{
Character character = entity as Character;
Client client = GameMain.Server.ConnectedClients.Find(c => c.Character == character);
if (client != null) client.Character = null;
}
removeQueue.Enqueue(entity);
}