EntityEventManagers send an empty event if the entity doesn't exist anymore when writing the message (may happen, for example, when a client is still waiting for some message about the item when it's destroyed in a deconstructor).
Not sending the events at all would be a better solution, but then we'd need to shift the IDs of all the consecutive events and make sure it doesn't mess anything up with any of the clients. Not necessarily worth the effort, considering how rare these "empty events" are.
This commit is contained in:
@@ -291,6 +291,14 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
UInt16 thisEventID = (UInt16)(firstEventID + (UInt16)i);
|
||||
UInt16 entityID = msg.ReadUInt16();
|
||||
|
||||
if (entityID == 0)
|
||||
{
|
||||
msg.ReadPadBits();
|
||||
sender.lastSentEntityEventID++;
|
||||
continue;
|
||||
}
|
||||
|
||||
byte msgLength = msg.ReadByte();
|
||||
|
||||
IClientSerializable entity = Entity.FindEntityByID(entityID) as IClientSerializable;
|
||||
|
||||
Reference in New Issue
Block a user