Fixed another bug in DockingPort that caused entity ID mismatches. Even though the server sent the IDs of the CURRENT hulls and gap of the docking port, they are not necessarily created in the correct order during midround syncing and may end up replacing the ID of another entity or another entity spawned after them may cause their IDs to be replaced. Closes #530

This commit is contained in:
Joonas Rikkonen
2018-07-26 12:41:54 +03:00
parent b309b45246
commit 50603b72f4
4 changed files with 21 additions and 50 deletions
@@ -56,9 +56,9 @@ namespace Barotrauma.Networking
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"Too much data in network event for entity \"" + e.Entity.ToString() + "\" (" + tempEventBuffer.LengthBytes + " bytes");
}
//the ID has been taken by another entity (the original entity has been removed) -> write an empty event
if (Entity.FindEntityByID(e.Entity.ID) != e.Entity)
else if (Entity.FindEntityByID(e.Entity.ID) != e.Entity || e.Entity.IdFreed)
{
//technically the clients don't have any use for these, but removing events and shifting the IDs of all
//consecutive ones is so error-prone that I think this is a safer option